#ds_map to struct conversion or read json as struct?

1 messages · Page 1 of 1 (latest)

lunar river
#

the title says it.

rotund island
#

Ideally, it's a lot better to keep the conversion as it is

#

ds_map -> json -> ds_map

#

struct -> json -> struct

#

(though tbh, you should be using structs anyway)

#

Is your initial data type a struct, or a ds_map? @lunar river

lunar river
#

my code works with struct and theres like 1000 lines of code using it that way but im also reading json files witch returns a ds_map, so i wana convert it.

rotund island
#

Yeah so

#

You're using the wrong function I presume

#

There's two json function sets, one for ds_maps

#

And one for structs

#

You have json_encode and json_decode

#

That's for ds_maps

#

You'd want

kind ravenBOT
#

This function parses a JSON string and converts it into a collection of nested arrays and structs. An array is the equivalent of a JSON array and a struct is the equivalent of a JSON object.

Arguments
json: The JSON string to parse
filter_func:  Filter function that processes each item. Don't pass a value or set this to undefined if you only want to set inhibit_string_convert. Syntax: function(key, value) -> new_value
inhibit_string_convert:  Set this to true to disable converting strings into runtime references. Default value: false

lunar river
#

ahah, il take a look!

#

works, thanks, i should realy put ya in my credits, damn!

rotund island
#

Well I won't complain haha 🫡

#

No worries

lunar river
#

il add you on discord so i can send ya a notification when the game comes out in english.

#

oh it says i cant