nsISupports
Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4)legacyDecodeToJSVal() method. However, you should use native JSON instead if at all possible.Implemented by: @mozilla.org/dom/json;1. To create an instance, use:
var nativeJSON = Components.classes["@mozilla.org/dom/json;1"]
.createInstance(Components.interfaces.nsIJSON);
JSObject decode(in AString str); Obsolete since Gecko 7.0 |
jsval decodeToJSVal(in AString str, in JSContext cx); Native code only! |
JSObject decodeFromStream(in ); |
AString encode(in JSObject value); Obsolete since Gecko 7.0 |
AString encodeFromJSVal(in Jsvaljsval value, in JSContext cx); Native code only! |
void encodeToStream(in JSObject value); |
jsval legacyDecode(in AString str); Deprecated since Gecko 2.0 |
jsval legacyDecodeFromStream(in AString str); Deprecated since Gecko 2.0 |
jsval legacyDecodeToJSVal(in AString str, in JSContext cx); Native code only! Deprecated since Gecko 2.0 |
Decodes a JSON string, returning the JavaScript object it represents.
JSObject decode( in AString str );
strThe original JavaScript object, reconstructed from the JSON string.
jsval for use in your native code. Don't forget to GCroot the result before using it.jsval decodeToJSVal( in AString str, in JSContext cx );
strThe original JavaScript object, reconstructed from the JSON string. Don't forget to GCroot the jsval before using it.
Decodes a JSON string read from an input stream, returning the JavaScript object it represents.
JSObject decodeFromStream( in nsIInputStream stream, in long contentLength );
streamnsIInputStream from which to read the JSON string.contentLengthA JSObject which is the original JavaScript object, reconstructed from the JSON string.
Encodes a JavaScript object into a JSON string.
AString encode( in JSObject value );
valueA JSON string representing the object.
jsval to a JSON string for use in your native code.AString encodeFromJSVal( in jsval value, in JSContext cx );
valueA JSON string representing the value.
Encodes a JavaScript object into JSON format, writing it to a stream.
void encodeToStream( in nsIOutputStream stream, in string charset, in boolean writeBOM in JSObject value );
streamnsIOutputStream to which to write the JSON string.charsetwriteBOMtrue if you wish to write a byte-order mark (BOM) into the stream, otherwise specify false.value Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Decodes a JSON string. This method accepts slightly more than the exact JSON syntax; details of extra accepted syntax are deliberately not described. This method is intended for use only by code processing legacy data. When the original instance requiring this function is removed, this method will be removed. Thus, this deprecated method should not be used.
jsval legacyDecode( in AString str );
strThe original JavaScript object, reconstructed from the JSON string.
Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Decodes a JSON string, read from a stream. This method accepts slightly more than the exact JSON syntax; details of extra accepted syntax are deliberately not described. This method is intended for use only by code processing legacy data. When the original instance requiring this function is removed, this method will be removed. Thus, this deprecated method should not be used.
jsval legacyDecodeFromStream( in nsIInputStream stream, in long contentLength );
streamnsIInputStream from which to read the JSON string to decode.contentLengthThe original JavaScript object, reconstructed from the JSON string.
Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Decodes a JSON string to a jsval. This method accepts slightly more than the exact JSON syntax; details of extra accepted syntax are deliberately not described. This method is intended for use only by code processing legacy data. When the original instance requiring this function is removed, this method will be removed. Thus, this deprecated method should not be used.
jsval for use in your native code. Don't forget to GCroot the result before using it.jsval legacyDecodeToJSVal( in AString str, in JSContext cx );
strThe original JavaScript object, reconstructed from the JSON string. Don't forget to GCroot the jsval before using it.