question

MoonHeonYoung avatar image
MoonHeonYoung asked

how to enter json value to item custom data?

It seems that only string/string can be entered in the player data key/value of the game manager

and the custom data key/value of the item catalog.

Does this not support various value types like json?

(key is a string, but the value is array, boolean, int, etc...)

I want to enter json in the value of the item custom data As above but error occurs

goagoao.png (23.4 KiB)
10 |1200

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

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

>> Does this not support various value types like json?

PlayFab supports using JSON as the values of the Custom Data.

>>I want to enter json in the value of the item custom data As above but error occurs

In a valid JSON, the nested K/V pairs’ keys also should be string. So, you can refer to the following format.

{
	"Func": {
		"name": "chest",
		"type": "weapon",
		"level": 4
	},
	"Icon": 4
}
2 comments
10 |1200

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

MoonHeonYoung avatar image MoonHeonYoung commented ·

Thank you for answer

When I copied and pasted the code of your answer,

the edit as KEY/value pair button of the custom data disappeared.

It seems to work only as an edit as string.

Why is this in this case? It seems like this happens when number exists in the value.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang MoonHeonYoung commented ·

Yes, if you want to let the [edit as key/value pair] button display, you need to convert the number value and object value to string value.

{"Func":"{\"name\":\"chest\",\"type\":\"weapon\",\"level\":4}","Icon":"4"}
0 Likes 0 ·

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.