question

lu.zhang@sectionstudios.com avatar image
lu.zhang@sectionstudios.com asked

Is there anyway to store nested Json object in the playfab?

How to store nested Json object in the playfab? For example, something like that.

{ 
    "stuff": {
        "onetype": [
            {"id":1,"name":"John Doe"},
            {"id":2,"name":"Don Joeh"}
        ],
        "othertype": {"id":2,"company":"ACME"}
    }, 
    "otherstuff": {
        "thing": [[1,42],[2,2]]
     }
}

 

 

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

For JSON objects, the simplest way to encode them as a string for storage in a Key/Value pair is by using the stringify() method. So if the top-level name of the object in your example was "foo", you could simply use foo.stringify() to turn the object into a string for storage. Similarly, you can convert it from a string using deserialize().

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lu.zhang@sectionstudios.com avatar image
lu.zhang@sectionstudios.com answered

Hi Brendan, thank you for the replying. That make sense. BTW, is there any limitation to the length of the string?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Yes, depending on the data type, that limitation will vary, though. Have a look at our limits page for specifics: http://playfab.com/limits/

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lu.zhang@sectionstudios.com avatar image
lu.zhang@sectionstudios.com answered

Thank you. I will pay attention to that.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.