You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, thanks again for the xml_Locate change from last week.
I have a issue/question about the JSON copy example.
Is my understanding correct that this code should duplicate the entire content of the from object to the destination objects?
// copy all elements: This is deep copy
json_copyValue ( pTo : '' : pFrom : '');
Because when I try this, my Content2 variable is empty in the firsty attempt, however, when I use mergeObject, it works just fine.
pFrom = json_parseString ('{ -
"s" : "Life is a gift", -
"a" : [1,2,3,4], -
"o" : { -
"x" : 100, -
"y" : 200 -
} -
}');
// "to" is just an empty object at begining
pTo = json_newObject();
pTo2 = json_newObject();
// copy all elements: This is deep copy
json_copyValue ( pTo : '' : pFrom : '');
Content = json_AsJsonText(pFrom);
Content2 = json_AsJsonText(pTo); //This will be empty!
// copy all elements: This is deep copy
//json_NodeCopy(pTo2:pFrom:json_FIRST_CHILD);
json_MergeObjects(pTo2:pFrom:json_REPLACE);
Content = json_AsJsonText(pFrom);
Content2 = json_AsJsonText(pTo2); //This will contain the same as Content
json_delete(pTo);
json_delete(pTo2);
json_delete(pFrom);
*inlr = *on;
What is the preferred way to copy a whole node to an other node?
The text was updated successfully, but these errors were encountered:
First - please notice that "MergeObjects" it the one to use. The older "NodeMerge" is deprecated, but have strang behaviour - but is used and cannot be removed.
next: json_copyValue is - as implied - values only
Let me just come back with an example of a deep merge..
Hello,
Firstly, thanks again for the xml_Locate change from last week.
I have a issue/question about the JSON copy example.
Is my understanding correct that this code should duplicate the entire content of the from object to the destination objects?
Because when I try this, my Content2 variable is empty in the firsty attempt, however, when I use mergeObject, it works just fine.
What is the preferred way to copy a whole node to an other node?
The text was updated successfully, but these errors were encountered: