mardi 21 avril 2015

How to get the structure of JSON in scala

I have a lot of JSON files which are not structured and I want to get a deeper element and all the element to get to it.

For example :

"menu": {
    "id": "file",
    "popup": {
        "menuitem": {
                      "-vdsr": "New",
                      "-sdst": "Open",
                      "-mpoi": "Close" }

In this case the result would be :


I tried Jackson and Json4s and they are efficient to go the last value but, I don't see how I can get the whole structure.

I want this to run a job with apache spark on very huge JSON files and the structure will be very complex for each. I also tried sparkSQL but if I don't know the entire structure I can't get it.

Aucun commentaire:

Enregistrer un commentaire