![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Node.js) Using JSON StringOf with Non-String MembersSee more JSON ExamplesIf a JSON member is a boolean, integer, or null, usingStringOf will return its string representation.
var os = require('os'); if (os.platform() == 'win32') { var chilkat = require('@chilkat/ck-node23-win64'); } else if (os.platform() == 'linux') { if (os.arch() == 'arm') { var chilkat = require('@chilkat/ck-node23-linux-arm'); } else if (os.arch() == 'arm64') { var chilkat = require('@chilkat/ck-node23-linux-arm64'); } else { var chilkat = require('@chilkat/ck-node23-linux-x64'); } } else if (os.platform() == 'darwin') { var chilkat = require('@chilkat/ck-node23-mac-universal'); } function chilkatExample() { // Create JSON with members of different data types. var json = new chilkat.JsonObject(); json.UpdateInt("a",123); json.UpdateBool("b",true); json.UpdateNull("c"); json.EmitCompact = false; console.log(json.Emit()); // Resulting JSON: // { // "a": 123, // "b": true, // "c": null // } var a = json.StringOf("a"); console.log(a); var b = json.StringOf("b"); console.log(b); var c = json.StringOf("c"); console.log(c); // Output // 123 // true // null // If you want to get the integer, boolean, or null value // you need to use the methods matching the data type var ival = json.IntOf("a"); var bval = json.BoolOf("b"); var hasNull = json.IsNullOf("c"); } chilkatExample(); |
||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.