Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: REST + JSON + JSON Parser

    Hi All,

    I'm new to the whole JSON thing. So my question is when a REST resource returns a response in the form of JSON, how do I know how the JSON response looks like?

    For example if the REST resource were returning data on a list of customers.

    Some customer may contain the following data:
    First Name, Last Name, Address, Phone Number, Array of Cars Owned

    But some may provide data in the following instead:
    First Name, Last Name, Array of Favorite Ice Creams, Name of Most Recent Post-Secondary Institution Attended

    Therefore due to the seemingly random nature of the responses given by the REST resource, is there a best practice of parsing the JSON response?

    On the REST resource side, is it a best practice for them to include the data fields left blank as well? Or do they simply omit them?

    Therefore I feel I need to guess the structure of the JSON response which makes dealing with REST responses very difficult.

    Please help!

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,354
    Thanks
    23
    Thanked 618 Times in 617 Posts
    Welcome to the forum ectobuilder.
    Therefore I feel I need to guess the structure of the JSON response which makes dealing with REST responses very difficult.
    Just place the response in a file and look at it. Most sites that send json data should tell you how it is formed or give you the program to request the data so I don't really see the problem.
    What sites are you having a problem with?
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •