Could not parse response into a JSON object

2,947 views
Skip to first unread message

nikolaos....@googlemail.com

unread,
Mar 11, 2014, 8:29:10 AM3/11/14
to gat...@googlegroups.com
Hi,

I've a simulation where I get those warn messages:

11:30:01.836 [WARN ] i.g.h.a.AsyncHandlerActor - Request 'SyncUpdate' failed: jsonPath($..syncid).exists failed, could not prepare: Could not parse response into a JSON object: Unable to parse JSON object

The current character read is '"' with an int value of 34
Unable to parse JSON object
line number 1
index number 1

Maybe the JSON-Response is too big?! 

Greetz
Niko

Stéphane Landelle

unread,
Mar 11, 2014, 8:32:16 AM3/11/14
to gat...@googlegroups.com
  • Which version of Gatling do you use?
  • Which version of JDK?
  • Could you provide a sample of your JSON string, please?


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nikolaos....@googlemail.com

unread,
Mar 11, 2014, 9:14:17 AM3/11/14
to gat...@googlegroups.com


Am Dienstag, 11. März 2014 13:32:16 UTC+1 schrieb Stéphane Landelle:
  • Which version of Gatling do you use?
- latest snapshot build 
  • Which version of JDK?
-  Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
  • Could you provide a sample of your JSON string, please?
-  The problem is that the JSON-Response is really huge so I can't paste it here. You can download it here -> JSON-Response

Stéphane Landelle

unread,
Mar 11, 2014, 9:24:02 AM3/11/14
to gat...@googlegroups.com
Could you confirm that it works fine with this replacement for gatling-http, please?

Stéphane Landelle

unread,
Mar 11, 2014, 9:27:38 AM3/11/14
to gat...@googlegroups.com
Can you reproduce every time, without load testing?
If so, would you mind debugging with me?

The problem is in the streaming parser mode that's triggered when the body is too big, and could be anywhere: in the parser itself, in the InputStream implementation, etc...

nikolaos....@googlemail.com

unread,
Mar 11, 2014, 9:31:58 AM3/11/14
to gat...@googlegroups.com
With the attached version it works :) Did you change anything?

Stéphane Landelle

unread,
Mar 11, 2014, 9:38:50 AM3/11/14
to gat...@googlegroups.com
I didn't fix anything: the problem is still here. I just increased the threshold from 1Mb to 10Mb so the parser now used the full body String of your 2.2Mb JSON document instead of an InputStream from the byte chunks.

I will investigate.

Thanks for reporting.

nikolaos....@googlemail.com

unread,
Mar 11, 2014, 10:04:08 AM3/11/14
to gat...@googlegroups.com
Okay thx for the support and quick response.

Stéphane Landelle

unread,
Mar 11, 2014, 10:07:44 AM3/11/14
to gat...@googlegroups.com
Just one thing: your document is huge and you should try to reduce the scope of your search.
In the sample you provided, syncid only appears as a root child, so $.syncid would be much better than $..syncid that scans the full tree.

nikolaos....@googlemail.com

unread,
Mar 11, 2014, 10:14:34 AM3/11/14
to gat...@googlegroups.com
Indeed a performance killer my fault. Thx once again

Stéphane Landelle

unread,
Mar 11, 2014, 10:16:50 AM3/11/14
to gat...@googlegroups.com
$.data.syncid actually :)

Stéphane Landelle

unread,
Mar 11, 2014, 10:56:50 AM3/11/14
to gat...@googlegroups.com
I could reproduce and confirm that this is a parser bug: https://github.com/RichardHightower/boon/issues/98

I think this will get fixed pretty soon, stay tuned.

Stéphane Landelle

unread,
Mar 12, 2014, 4:45:09 AM3/12/14
to gat...@googlegroups.com
Fixed!
I advice you update your snapshot, will be way better for your use case of huge JSON payloads.

nikolaos....@googlemail.com

unread,
Mar 12, 2014, 4:51:12 AM3/12/14
to gat...@googlegroups.com
Verified fixed :) thx

Stéphane Landelle

unread,
Mar 12, 2014, 6:04:17 AM3/12/14
to gat...@googlegroups.com
Thanks for your feedback!

Also, we've put lots of efforts in this upcoming release in JSON support and JsonPath.
So we'd really appreciate if you could provide feedback on how it behaves for you, like is memory and CPU usage reasonable even when dealing with huge files such as yours.

Cheers,

Stéphane

nikolaos....@googlemail.com

unread,
Mar 12, 2014, 9:07:26 AM3/12/14
to gat...@googlegroups.com
Yes of course :) and I just read the comments from your reported issue at boon :D lol the guy seems to be cool but I think he hates our "responses from hell" :D :D :D

Stéphane Landelle

unread,
Mar 12, 2014, 10:34:23 AM3/12/14
to gat...@googlegroups.com
Yep, Rick is a very nice guy, but he... speaks his mind. :)
He originally developed his parser for his own usage: very short messages for low latency systems.
I keep on pressing him with complex use cases he didn't anticipate.
He's grumpy at first, but he loves challenges ;)


Rick Hightower

unread,
Apr 30, 2014, 1:01:42 AM4/30/14
to gat...@googlegroups.com
LOL

Getting more sleep now. Less grumpy. 

Martin Hollmichel

unread,
Aug 6, 2014, 8:51:24 AM8/6/14
to gat...@googlegroups.com
Hi,

I now have a simliar issue with both (boon and preferjackson) in 2.0.0rc1:

jsonPath($.timestamp).exists failed, could not prepare: Could not parse response into a JSON object: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.ByteArrayInputStream@4b41956d; line: 1, column: 2]


jsonPath($..data).exists failed, could not prepare: Could not parse response into a JSON object: Unable to determine the current character, it is not a string, number, array, or object The current character read is '<' with an int value of 60 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript">(parent["callback_new"] || window.opener && window.opener["callback_new"])({"data":"210","timestamp":1407326668105})</script></head></html> ^

the response is starting this way:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript">(parent["callback_new"] || window.opener && window.opener["callback_new"])({"data":"208","timestamp":1407324466071})</script></head></html>

the httprequest is a multipart post, for other httprequests the jsonPath query works well.

greetings,

Martin



Am Mittwoch, 12. März 2014 11:04:17 UTC+1 schrieb Stéphane Landelle:

Pierre DAL-PRA

unread,
Aug 6, 2014, 2:36:01 PM8/6/14
to gat...@googlegroups.com
Hi Martin,

Well... there's nothing strange about it : jsonPath works on a JSON input, not on a JSON string hidden somewhere in a HTML page :)
In your case, you have to fall back to regular expressions.
Message has been deleted

Kapil

unread,
Aug 15, 2018, 3:52:18 AM8/15/18
to Gatling User Group
I think my problem is also looks similar to this one

Getting following error when system is under load

jsonPath($.user.id).find.exists failed, could not prepare: Boon failed to parse into a valid AST: JsonException: Unable to determine the current character, it is not a string, number, array, or object The current character read is '<' with an int value of 60 Unable to determine the current character, it is not a string, number, array, or object line number 16 index number 15 <!DOCTYPE html> ^

jsonPath($.access_token).find.noop failed, could not prepare: Boon failed to parse into a valid AST: JsonException: Unable to determine the current character, it is not a string, number, array, or object The current character read is 'T' with an int value of 84 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 0 The specified CGI application encountered an error and the server terminated the process. ^

Any Idea ?
Reply all
Reply to author
Forward
0 new messages