Closed achukka closed 9 years ago
The parser expects JSON to be in a specific format that's described in the readme. It doesn't accept arbitrary JSON maps as input.
Normal json format java gives me will be similar to this {"balance":1000.1,"num":1000,"is_imp":true,"name":"Object"}.
So you mean I cannot convert a normal json object to pdf using this?
You cannot convert arbitrary JSON objects using this library. The JSON input has to be in the format specified in the documentation.
Hi yogthos,
I'm trying to convert a json object into PDF. But It is giving me Unknown source exception.
Find the code below. JSONParser parser=new JSONParser(); Object object=parser.parse(new FileReader("TextFile.txt")); JSONObject jsonObject = (JSONObject)object; String jsonString = jsonObject.toJSONString(); JsonPDF.writeToFile(jsonString, dir + "MyFile.pdf");
JSON Object : TextFile.txt {"balance":1000.1,"num":1000,"is_imp":true,"name":"Object"}
This is the error I'm getting
ERROR c.e.p.s.r.e.GeneralExceptionMapper - An unmapped exception was intercepted java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap at clojure.lang.RT.nthFrom(RT.java:857) ~[clojure-1.6.0.jar:na] at clojure.lang.RT.nth(RT.java:807) ~[clojure-1.6.0.jar:na] at clj_pdf.core$write_doc.invoke(core.clj:822) ~[json-to-pdf-0.6.9.jar:na] at clj_pdf.core$pdf.invoke(core.clj:875) ~[json-to-pdf-0.6.9.jar:na] at json_to_pdf.core$_writeToFile.invoke(core.clj:12) ~[json-to-pdf-0.6.9.jar:na] at org.yogthos.JsonPDF.writeToFile(Unknown Source) ~[json-to-pdf-0.6.9.jar:na]
Thanks Aditya