0

Exception in thread "main" java.text.ParseException

at org.json.JSONTokener.syntaxError(JSONTokener.java:374)

at org.json.JSONObject.<init>(JSONObject.java:154)

at org.json.JSONTokener.nextValue(JSONTokener.java:289)

at org.json.JSONArray.<init>(JSONArray.java:76)

at org.json.JSONTokener.nextValue(JSONTokener.java:293)

at org.json.JSONObject.<init>(JSONObject.java:143)

at org.json.JSONObject.<init>(JSONObject.java:166)
  • I assume you are trying to convert some string to a JSONObject - please post what you are trying to parse and what code are you using to do it – Peter Hull Jun 21 '19 at 11:05
  • Where is your code ? Stacktrace is not enough to track your problem. Please look at [ParseException Java](https://stackoverflow.com/questions/16116652/parseexception-java) – Sudhir Ojha Jun 21 '19 at 11:05
  • its too long a JSON and I am trying to post but unable to do so – user8618585 Jun 21 '19 at 11:07
  • Ok here is the link http://www.gundersenhealth.org/find-a-doctor/profile/atif-ahmed/ and from this I got script tag application/ld+json .It works fine when I just copy paste it but when I get it using jdom xpath it gives me error – user8618585 Jun 21 '19 at 11:12
  • { "@type": "Review", "reviewRating": { "@type": "Rating", "ratingValue": "5", "bestRating": "5", "worstRating": "1" }, "description": "First: "Thank you" for the opportunity.", "author": { "@type": "Person", "name": "Anonymous" } } – user8618585 Jun 21 '19 at 11:28
  • The double quotes of "Thank you" were the culprit .any solutions on how to escape quotes inside json – user8618585 Jun 21 '19 at 11:29
  • In JSON you can use back-slash to escape a quote, however in the web data you cited they use HTML entites ( `"` ) to do it. I guess either OK, depends what you want to do with the data. – Peter Hull Jun 21 '19 at 14:55

0 Answers0