# Could not parse response into a JSON object

**URL:** <https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869>\
**Category:** Gatling (Open-Source)\
**Created:** [March 11, 2014, 12:29pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869 "2014-03-11T12:29:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 11, 2014, 12:29pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/1 "2014-03-11T12:29:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 12:32pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/2 "2014-03-11T12:32:16Z")

</div>

- Which version of Gatling do you use?

- Which version of JDK?

- Could you provide a sample of your JSON string, please?

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 11, 2014, 1:14pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/3 "2014-03-11T13:14:17Z")

</div>

> - Which version of Gatling do you use?

- latest snapshot build

> - 
> - Which version of JDK?

- Java™ 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](https://appsuite-dev.open-xchange.com/publications/documents/1/df7e9af495c6f9956e982c29d4f8340)

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 1:24pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/4 "2014-03-11T13:24:02Z")

</div>

Could you confirm that it works fine with this replacement for gatling-http, please?  
[https://docs.google.com/file/d/0B1zTVlhQrNiyV3pqejI2WmlwdmM/edit](https://docs.google.com/file/d/0B1zTVlhQrNiyV3pqejI2WmlwdmM/edit)

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 1:27pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/5 "2014-03-11T13:27:38Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 11, 2014, 1:31pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/6 "2014-03-11T13:31:58Z")

</div>

With the attached version it works 🙂 Did you change anything?

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 1:38pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/7 "2014-03-11T13:38:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 11, 2014, 2:04pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/8 "2014-03-11T14:04:08Z")

</div>

Okay thx for the support and quick response.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 2:07pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/9 "2014-03-11T14:07:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 11, 2014, 2:14pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/10 "2014-03-11T14:14:34Z")

</div>

Indeed a performance killer my fault. Thx once again

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 2:16pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/11 "2014-03-11T14:16:50Z")

</div>

$.data.syncid actually 🙂

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 11, 2014, 2:56pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/12 "2014-03-11T14:56:50Z")

</div>

I could reproduce and confirm that this is a parser bug: [https://github.com/RichardHightower/boon/issues/98](https://github.com/RichardHightower/boon/issues/98)

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 12, 2014, 8:45am UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/13 "2014-03-12T08:45:09Z")

</div>

Fixed!  
I advice you update your snapshot, will be way better for your use case of huge JSON payloads.

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 12, 2014, 8:51am UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/14 "2014-03-12T08:51:12Z")

</div>

Verified fixed 🙂 thx

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 12, 2014, 10:04am UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/15 "2014-03-12T10:04:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [March 12, 2014, 1:07pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/16 "2014-03-12T13:07:26Z")

</div>

Yes of course 🙂 and I just read the comments from your reported issue at boon 😃 lol the guy seems to be cool but I think he hates our “responses from hell” 😃 😃 😃

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 12, 2014, 2:34pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/17 "2014-03-12T14:34:23Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![Rick\_Hightower](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@Rick\_Hightower](https://community.gatling.io/u/Rick_Hightower)\
**Post date:** [April 30, 2014, 5:01am UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/18 "2014-04-30T05:01:42Z")

</div>

LOL

Getting more sleep now. Less grumpy.

---

<div class="post-metadata">

**Author:** ![Martin\_Hollmichel](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Martin\_Hollmichel](https://community.gatling.io/u/Martin_Hollmichel)\
**Post date:** [August 6, 2014, 12:51pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/19 "2014-08-06T12:51:24Z")

</div>

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 ^

the response is starting this way:

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

greetings,

Martin

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [August 6, 2014, 6:36pm UTC](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869/20 "2014-08-06T18:36:01Z")

</div>

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.

[Next page](https://community.gatling.io/t/could-not-parse-response-into-a-json-object/869.md?page=2)
