I'm trying to parse a JSON string into a Map using ObjectMapper. To achieve this, I used this simple code below.
ObjectMapper objectMapper = new ObjectMapper(); Map value = objectMapper.readValue((String) mainJsonValueMap, Map.class); The code runs without any error, and all the property keys are visible in the created map; but some of the values are truncated.
In this example, I used the JSON string below:
{ "Vmax": null, "Pictures": "[{\"code\":\"603442f0-2e92-406a-a25c-4c090b750d01:1.0\",\"filename\":\"test-file (2).jpeg\",\"content\":null}]", "2D&3D files": null, "logical_match": null, "Certifications": null, "Geographic_area": "EU", "US_price_factor": 1.58, "Technical documents": "{\"deu\":[{\"code\":\"fdceed2a-9703-4186-b7a0-101e6d82eec6:2.0\",\"filename\":\"project_gobo_c210_slice_integral_assembly instruction_de_it_en.pdf\",\"content\":\"\"},{\"code\":\"d729a7f2-e782-4c71-8ee1-97f22d8d5659:1.0\",\"filename\":\"project_chameleon_c210 slice_gobo_datenblatt_de.pdf\",\"content\":\"\"}],\"ita\":[{\"code\":\"fdceed2a-9703-4186-b7a0-101e6d82eec6:1.0\",\"filename\":\"project_gobo_c210_slice_integral_assembly instruction_de_it_en.pdf\",\"content\":\"\"},{\"code\":\"ccb9cf28-53bc-45f9-868d-b3d29bdf79bd:1.0\",\"filename\":\"project_chameleon_c210 slice_gobo_scheda tecnica_it.pdf\",\"content\":\"\"},{\"code\":\"dad959ce-95b5-4d8d-b524-1a43cd623c8f:1.0\",\"filename\":\"test-file2.json\",\"content\":null}],\"fr\":[{\"code\":\"1f6a7ca9-b816-444d-8f32-1a0b3363e834:1.0\",\"filename\":\"project_gobo_c210_slice_integral_instructions de montage_fr.pdf\",\"content\":\"\"},{\"code\":\"52e50fb1-4e03-42b7-96b5-3e7a8e651848:1.0\",\"filename\":\"project_chameleon_c210 slice_gobo_fiche technique_fr.pdf\",\"content\":\"\"}],\"eng\":[{\"code\":\"fdceed2a-9703-4186-b7a0-101e6d82eec6:3.0\",\"filename\":\"project_gobo_c210_slice_integral_assembly instruction_de_it_en.pdf\",\"content\":\"\"},{\"code\":\"3d3c82ab-c0cb-4f66-bf68-cde6d1c43519:1.0\",\"filename\":\"project_chameleon_c210 slice_gobo_datasheet_en.pdf\",\"content\":\"\"},{\"code\":\"0b8fccce-fc88-47e9-9837-f44b6dfc9ed3:1.0\",\"filename\":\"00logo2.png\",\"content\":\"\"}]}", "Configurator picture": "{\"code\":\"e29ac4ef-1a3f-4dc0-9c4e-0181543dd5fd:1.0\",\"filename\":\"test-file (1).jpeg\",\"content\":null}", "current_max_with_RBL": null, "lens_block_image_file": null, "luminaire_installation": null, "ball proof certification": false } But for the property Technical documents, ObjectMapper generates the string below. Which as you can see it's being cut in the middle.
{"deu":[{"code":"fdceed2a-9703-4186-b7a0-101e6d82eec6:2.0","filename":"project_gobo_c210_slice_integral_assembly instruction_de_it_en.pdf","content":""},{"code":"d729a7f2-e782-4c71-8ee1-97f22d8d5659:1.0","filename":"project_chameleon_c210 slice_gobo_datenblatt_de.pdf","content":""}],"ita":[{"code":"fdceed2a-9703-4186-b7a0-101e6d82eec6:1.0","filename":"project_gobo_c210_slice_integral_assembly instruction_de_it_en.pdf","content":""},{"code":"ccb9cf28-53bc-45f9-868d-b3d29bdf79bd:1.0","filename":"project_chameleon_c210 slice_gobo_scheda tecnica_it.pdf","content":""},{"code":"dad959ce-95b5-4d8d-b524-1a43cd623c8f:1.0","filename":"test-file2.json","content":null}],"fr":[{"code":"1f6a7ca9-b816-444d-8f32-1a0b3363e834:1.0","filename":"project_gobo_c210_slice_integral_instructions de montage_fr.pdf","content":""},{"code":"52e50fb1-4e03-42b7-96b5-3e7a8e651848:1.0","filename":"project_chameleon_c210 slice_gobo_fiche technique_fr.pdf","content":""}],"eng":[{"code":"fdceed2a-9703-4186-b7a0-101e6d82eec6:3.0","filename":"project_gobo I assumed there was a problem with my JSON string, but when I validated it with JSONLint it seemed fine. Can anyone help me fix this issue?
Note: Values staying as String is fine for me. I just want to get the whole string without truncation.
Pictures,Technical documents, andConfigurator pictureare all strings. They are escaped JSON values. You will need to probably write your own value deserializer for those fields.Stringand adding.length())?