Post Map<String, Object>

Hey. I want to upload a JSONObject (which is just a Map<String, Object> with some extra features but can be converted to a Map) but have no idea how.
Is there a short way or do I really have to write every single Object, Array and Value like this

FAUNA_CLIENT.query(
                Update(
                        Ref(Collection("myCollection"), "MY_ID"),
                        Object("name", Value("value"))
                )
        ).get();

?

HI @MrKleeblatt and welcome!

The Object and Value functions are required for the driver to form the resulting HTTP request correctly.

If you have a class that you are commonly using and are saving to Fauna, then you can create a helper function to serialize that class. But the driver doesn’t do that out of the box.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.