I'm having difficulty in parsing my json file into something that I can work with. The json file looks like this:
{
    "characterizations_values": [
        {
            "filename": "TestDoc",
            "sheet": {
                "my-title": [
                    {
                        "number": "ddddko9",
                        "numbered-part": "test number",
                        "documents": [
                            [
                                {
                                    "document_name": "20 Minutes",
                                    "document-category": [
                                        "Accounting",
                                        "Cost-Management"
                                    ]
                                }
                            ]
                        ] 
                    }
                ],
                "my-notes": [
                    {
                        "dimensions": {
                            "enclosing": {
                                "test-one": 34.33,
                                "test-two": 34
                            },
                            "enclosing-extra": {
                                "test-one": 27.33,
                                "test-two": 88
                            }
                        }
                    }
                ]
            }
        }
    ]
}
What I've attempted with the library json-simple is the following:
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
                Map<String, String> curValues = (Map<String,String>) curBlock.get("characterizations_values");
                
                // break down sheet
                JSONObject sheet = new JSONObject();
                sheet.put("sheet", curValues.get("sheet"));
                LOG.info(String.format("sheet: %s", sheet.toString()));
                // Get my title     
                JSONObject myTitle = new JSONObject();
                myTitle.put("title_blocks", sheet.get("my-title"));
                
                // Get my notes
                JSONObject myNotes = new JSONObject();
                myNotes.put("my-notes", sheet.get("my-notes"));
This doesn't however work and while I get a json object with a key I get a null value for the value. I've also attempted to cast this into a JSONArray but then I get an error message saying that "java.util.LinkedHashMap cannot be cast to..". After reading a few posts I understand that the library doesn't have enough information to deserialise the object. But given the structure, I think that I would first need to get a JSON object and then single out the JSONArray. So the order would be:
- get my-title JSONObject
 - get value of mytitle which is a JSONArray
 - Keep working down the document path
 
If there is a better way to do this I'm very much open to suggestions.
Thanks in advance!