Subdoc JSON document to POJO

Hi,

I have a subdoc api created document which of below structure:

  {  
  "root_path":{  
    "level_1":{  
      "level_2":{  
        "field1":"value1",
        "field2":"value2",
        "field3":"value3"
      },
      "field1":"value1",
      "field2":"value2",
      "field3":"value3"
    }
  }
}

Note that: level_1, level_2 are dynamic and literally could be any string.
After lot of digging around, still wondering if there is an efficient way of converting this json to pojo generically ?

Appreciate any help.
Thanks

Hi @ravikrn.13,

It can be retrieved as a JsonDocument and the content is a pojo JsonObject. JsonObject obj = bucket.get("doc").content();

1 Like