Merge (TJSon)
De Wiki1000
(Différences entre les versions)
(Page créée avec « <source lang="delphi">procedure Merge(value:TJSon);</source> Cette méthode permet de fusionner des documents. Exemples: <source lang="delphi"> //Procedure JsonParser; ... ») |
|||
Ligne 31 : | Ligne 31 : | ||
showMessage(json1.AsString); | showMessage(json1.AsString); | ||
end; | end; | ||
− | |||
</source> | </source> | ||
+ | |||
+ | <pre> | ||
+ | [ | ||
+ | { | ||
+ | "employees": [ | ||
+ | { | ||
+ | "firstName": "John", | ||
+ | "lastName": "Doe" | ||
+ | }, | ||
+ | { | ||
+ | "firstName": "Anna", | ||
+ | "lastName": "Smith" | ||
+ | }, | ||
+ | { | ||
+ | "firstName": "Peter", | ||
+ | "lastName": "Jones" | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "customers": [ | ||
+ | { | ||
+ | "firstName": "John", | ||
+ | "lastName": "Doe" | ||
+ | }, | ||
+ | { | ||
+ | "firstName": "Anna", | ||
+ | "lastName": "Smith" | ||
+ | }, | ||
+ | { | ||
+ | "firstName": "Peter", | ||
+ | "lastName": "Jones" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | </pre> | ||
Voir aussi: | Voir aussi: | ||
[[Category:TJson]] | [[Category:TJson]] |
Version actuelle en date du 6 décembre 2013 à 15:22
procedure Merge(value:TJSon);
Cette méthode permet de fusionner des documents.
Exemples:
//Procedure JsonParser; var json1,json2:TJson; begin json1 := TJson.Create( '{ "employees": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" } ] }' ); json2 := TJson.Create( '{ "customers": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" } ] }' ); json1.Merge(json2); showMessage(json1.AsString); end;
[ { "employees": [ { "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", "lastName": "Smith" }, { "firstName": "Peter", "lastName": "Jones" } ] }, { "customers": [ { "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", "lastName": "Smith" }, { "firstName": "Peter", "lastName": "Jones" } ] } ]
Voir aussi: