Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. JSON type representation

JSON type representation

JSON is a convenient and widely used format for serializing objects, arrays, numbers, strings, booleans, and null.JSON does not support all data types allowed by JavaScript, which means that JavaScript objects that use these incompatible types cannot be directly serialized to JSON.

TheJSON type representation of a JSON-incompatible object is an equivalent JavaScript object with properties encoded such that the informationcan be serialized to JSON.This typically has the same properties as the original object for compatible data types, while incompatible properties are converted/serialized to compatible types.For example, buffer properties in the original object might bebase64url-encoded to strings in the JSON-type representation.

An object that cannot automatically be serialized to JSON using theJSON.stringify() method can define an instance method namedtoJSON() that returns theJSON-type representation of the original object.JSON.stringify() will then usetoJSON() to get the object to stringify, instead of the original object.PublicKeyCredential.toJSON() andPerformance.toJSON() are examples of this approach.

A JSON string serialized in this way can be deserialized back to theJSON-type representation object usingJSON.parse().It is common to provide a converter method, such asPublicKeyCredential.parseCreationOptionsFromJSON(), to convert theJSON-type representation back to the original object.


[8]ページ先頭

©2009-2026 Movatter.jp