[Fiware-developer-experience] Minor Issue in JSON response

David Muriel dmuriel at bitergia.com
Thu Jul 23 00:26:59 CEST 2015


On Wed, Jul 22, 2015 at 4:49 PM, Pablo Fernández Moniz
<pablofernandezmoniz at gmail.com> wrote:
> Hi!

Hello,

> We have downloaded the new images and now we have a problem parsing the JSON
> response for the http://compose_devguide_1/api/orion/restaurants/ petition.
>
> Concretely, we get the an  "SyntaxError: JSON.parse: bad control character
> in string literal at line 65332 column 120 of the JSON data" error when we
> use the JSON.parse function.
>
> If we used a online JSON validator (wich could be
> http://www.freeformatter.com/json-validator.html or
> http://jsonformatter.curiousconcept.com/ )  using the response, it doesn't
> pass it.

I've tried http://www.freeformatter.com/json-validator.html and it says:

  The JSON input is valid in JavaScript.
  The JSON input is valid according to RFC 4627 (JSON specfication).

> One of the detected errors is the use of doble quotes inside strings. An
> example of this issue of the Zarate restaurant can be examined in the image
> [QuoteError]

Yesterday (tuesday 21st) we pushed the fix for this bug.  I'm testing
it right now with the latest images and it's returning the quotes
properly escaped.  Also, are you loading the data via the
restaurant_feeder.js script or using the preloaded data image?  Maybe
we didn't notify you of this fix, sorry.

> Also we still have no data on reservations, is that what we have to expect
> for the moment?

The preloaded data image has data for reservations and reviews
(created via the reservations_generator.js and reviews_generator.js
scripts).

> Maybe we are doing something wrong?
>
> Another minor issue is that the API is not providing a JSON response
> although we use the Accept: application/json header. The API always return a
> tex/html as Content-Type, see [NotJSONResponse]
>
> Do you think possible, or recommendable, to return the response directly as
> JSON format? This should makes a little easier to parse the content from the
> front end.

I've just pushed a fix to add the header when returning JSON data from
orion.  A new version of the fiware-devguide-app image has just
finished building on docker hub.

Regards,

-- 
David Muriel.



More information about the Fiware-developer-experience mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy