Getting JSON Parse error while running the Active scan

8 views
Skip to first unread message

Omkar Kumbhar

unread,
Sep 19, 2022, 5:19:18 AMSep 19
to OWASP ZAP Developer Group
Hi Team,

I export all the request from History tab from ZAP GUI and save it as HAR file. I have one automation job to which I pass this HAR file as input. However many times I get the following JSON Parse error. Can somebody help me understand why the ZAP says invalid JSON even after exporting the same JSON file from ZAP itself.

Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ 369109 [ZAP-ActiveScanner-1] WARN org.parosproxy.paros.core.scanner.VariantJSONQuery - Failed to parse the request body: Input is invalid JSON; does not start with '{' or '[', c=-1 java.lang.IllegalArgumentException: Input is invalid JSON; does not start with '{' or '[', c=-1    at org.parosproxy.paros.core.scanner.VariantJSONQuery.parseObject(VariantJSONQuery.java:127) ~[zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.VariantJSONQuery.parseContent(VariantJSONQuery.java:77) ~[zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.VariantAbstractRPCQuery.setRequestContent(VariantAbstractRPCQuery.java:144) ~[zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.VariantAbstractRPCQuery.setMessage(VariantAbstractRPCQuery.java:60) [zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.AbstractAppParamPlugin.scan(AbstractAppParamPlugin.java:86) [zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.AbstractPlugin.run(AbstractPlugin.java:333) [zap-2.11.1.jar:2.11.1]    at java.lang.Thread.run(Thread.java:829) [?:?] 369106 [ZAP-ActiveScanner-0] WARN org.parosproxy.paros.core.scanner.VariantJSONQuery - Failed to parse the request body: Input is invalid JSON; does not start with '{' or '[', c=-1 java.lang.IllegalArgumentException: Input is invalid JSON; does not start with '{' or '[', c=-1    at org.parosproxy.paros.core.scanner.VariantJSONQuery.parseObject(VariantJSONQuery.java:127) ~[zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.VariantJSONQuery.parseContent(VariantJSONQuery.java:77) ~[zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.VariantAbstractRPCQuery.setRequestContent(VariantAbstractRPCQuery.java:144) ~[zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.VariantAbstractRPCQuery.setMessage(VariantAbstractRPCQuery.java:60) [zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.AbstractAppParamPlugin.scan(AbstractAppParamPlugin.java:86) [zap-2.11.1.jar:2.11.1]    at org.parosproxy.paros.core.scanner.AbstractPlugin.run(AbstractPlugin.java:333) [zap-2.11.1.jar:2.11.1]    at java.lang.Thread.run(Thread.java:829) [?:?] Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof

Thanks,
Omkar

thc...@gmail.com

unread,
Sep 19, 2022, 5:43:12 AMSep 19
to zaproxy...@googlegroups.com
Hi.

There are not enough details to know if there's an issue exporting or
importing the HAR file.
Does the request have a body?

In any case that exception will no longer happen, ZAP will no longer try
scan an empty JSON body.
https://github.com/zaproxy/zaproxy/issues/7174

Best regards.

Omkar Kumbhar

unread,
Sep 19, 2022, 6:18:40 AMSep 19
to OWASP ZAP Developer Group
Hi,

The issue is occurring while importing the HAR file using ZAP API. I am exporting the HTTP history from GUI and saving it as HAR file. When I open the same HAR file in browser it also opens in a browser properly.

Please find below the error which occurs while importing. It doesn't happen with every HAR file, it happens only with some HAR files.

Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof ^ Parsing message body failed: Invalid JSON: <json>:1:0 Expected json literal but found eof

Thanks,
Omkar

Reply all
Reply to author
Forward
0 new messages