mendix / RestServices

REST service module for Mendix. Supports consuming and publishing REST based services and real-time data synchronization. Supports JSON, form-encoded, multipart and binary data transport.
Apache License 2.0
31 stars 46 forks source link

Parse Exception on valid REST object #45

Closed ernororive closed 9 years ago

ernororive commented 9 years ago

When a JSON object starts with '[' instead of a '{' the REST module reports a Parse exception.

java.lang.RuntimeException: java.lang.IllegalArgumentException: Response body does not seem to be a valid JSON Object. A JSON object starts with '{' but found: [{"rechtspersoon":"Mendix B.V.","vestigingsnummer":"000018877206","adres":"Gedempte Zalmhaven 4 K","woonplaats":"Rotterdam","kvk":"243797260000","handelsnamen":{"bestaand":["Mendix

When I validates the JSON object using http://jsonlint.com/ it seems a valid object.

The REST Service which I am trying to use is: http://officieel.openkvk.nl/rest/mendix

I hope if this is valid JSON that this can be fixed.

Thanks Kind Regards Erno

mweststrate commented 9 years ago

Hi Erno,

Your json is a collection (mulitple objects), instead of a single object. So in that case you should use the getCollection call instead of get

Michel

On Mon, Nov 10, 2014 at 11:22 AM, ernororive notifications@github.com wrote:

When a JSON object starts with '[' instead of a '{' the REST module reports a Parse exception.

java.lang.RuntimeException: java.lang.IllegalArgumentException: Response body does not seem to be a valid JSON Object. A JSON object starts with '{' but found: [{"rechtspersoon":"Mendix B.V.","vestigingsnummer":"000018877206","adres":"Gedempte Zalmhaven 4 K","woonplaats":"Rotterdam","kvk":"243797260000","handelsnamen":{"bestaand":["Mendix

When I validates the JSON object using http://jsonlint.com/ it seems a valid object.

The REST Service which I am trying to use is: http://officieel.openkvk.nl/rest/mendix

I hope if this is valid JSON that this can be fixed.

Thanks Kind Regards Erno

— Reply to this email directly or view it on GitHub https://github.com/mendix/RestServices/issues/45.

ernororive commented 9 years ago

Ah, that simple ☺

Thx Gr Erno


[Mendix] Erno Rorive – Sales Engineer | M +316 27 3996 13

From: Michel Weststrate [mailto:notifications@github.com] Sent: Monday, November 10, 2014 12:14 PM To: mendix/RestServices Cc: Erno Rorive Subject: Re: [RestServices] Parse Exception on valid REST object (#45)

Hi Erno,

Your json is a collection (mulitple objects), instead of a single object. So in that case you should use the getCollection call instead of get

Michel

On Mon, Nov 10, 2014 at 11:22 AM, ernororive notifications@github.com<mailto:notifications@github.com> wrote:

When a JSON object starts with '[' instead of a '{' the REST module reports a Parse exception.

java.lang.RuntimeException: java.lang.IllegalArgumentException: Response body does not seem to be a valid JSON Object. A JSON object starts with '{' but found: [{"rechtspersoon":"Mendix B.V.","vestigingsnummer":"000018877206","adres":"Gedempte Zalmhaven 4 K","woonplaats":"Rotterdam","kvk":"243797260000","handelsnamen":{"bestaand":["Mendix

When I validates the JSON object using http://jsonlint.com/ it seems a valid object.

The REST Service which I am trying to use is: http://officieel.openkvk.nl/rest/mendix

I hope if this is valid JSON that this can be fixed.

Thanks Kind Regards Erno

— Reply to this email directly or view it on GitHub https://github.com/mendix/RestServices/issues/45.

— Reply to this email directly or view it on GitHubhttps://github.com/mendix/RestServices/issues/45#issuecomment-62370650.