How to assign JSON data structure as a new object?

Elder

Villager
Member
Joined
Mar 14, 2012
Messages
21
Reaction score
5
First Language
French
Primarily Uses
In RPG Maker VX, it's achieved this way:

map = RPG::Map.new(17, 15)This is very useful to alter data dynamically while the game is running. Anyone know how it can done in MV? There's no clue in the documentation. Although of course the bit of information can be taken from the .json files, but I was wondering if there was a more convenient way offered by MV.
 
Last edited by a moderator:

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
to parse JSON string

var yourVar = JSON.parse(aJsonString); to make a JSON string from an object (i think it's same like Marshal.dump on Ace)

Code:
var yourVar = JSON.stringify(anObject);
to make a deep copy of an object, you can use
Code:
var yourVar = JSON.parse(JSON.stringify(anObject));
or
Code:
JsonEx.makeDeepCopy(anObject); 
Hope this could help you :)
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top