Using a raw json string for mutate-in value



we use a custom JSON serializer so we create documents using the RawJsonDocument. We would like to use the sub-document API from the Java SDK to insert JSON fragments into existing documents, e.g. {“abc” : “def”, “ghi” : “jkl”}. I tried the mutate-in operation providing it with the JSON fragment as a String, but it inserted {\“abc\” : \“def\”, \“ghi\” : \“jkl\”} so it obviously treated it like a plain String. Everything was inserted ok when I used a JsonObject as the value, but that in our case means two conversions (POJO -> JSON String -> JSONObject), which we would like to avoid. Is there please a way to insert JSON fragments as a raw JSON string using the sub-document API? Btw, I’ve found a blog post

where I can see it as an example in some pseudo-code

                           {'num': '775-867-5309', 'ext': 16},

Thanks in advance for any help!


The example you have found is not pseudo code, it is python code.