Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Re: REST + JSON + JSON Parser
03-24-2014, 12:45 PM #1
- Join Date
- Mar 2014
- Thanked 0 Times in 0 Posts
Re: REST + JSON + JSON Parser
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.
03-24-2014, 01:47 PM #2
- Join Date
- Jan 2011
- Thanked 727 Times in 725 Posts
Welcome to the forum ectobuilder.
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.Therefore I feel I need to guess the structure of the JSON response which makes dealing with REST responses very difficult.
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."