Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(C# UWP/WinRT) JSON: Renaming and Deleting MembersDemonstrates renaming and deleting members. This example uses the following JSON document: { "apple": "red", "lime": "green", "banana": "yellow", "broccoli": "green", "strawberry": "red" }
Chilkat.JsonObject json = new Chilkat.JsonObject(); bool success = json.Load("{\"apple\": \"red\",\"lime\": \"green\",\"banana\": \"yellow\",\"broccoli\": \"green\",\"strawberry\": \"red\"}"); if (success != true) { Debug.WriteLine(json.LastErrorText); return; } // Rename "lime" to "lemon". success = json.Rename("lime","lemon"); // Change the color to yellow: success = json.SetStringOf("lemon","yellow"); // Rename by index. Banana is at index 2 (apple is at index 0) success = json.RenameAt(2,"bartlett_pear"); // Delete broccoli by name success = json.Delete("broccoli"); // Delete apple by index. Apple is at index 0. success = json.DeleteAt(0); json.EmitCompact = false; Debug.WriteLine(json.Emit()); |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.