The JSON macro can parse a JSON string. It exposes properties to query the resulting object and methods to modify it.
Syntax
Smartsite SXML | Copy Code |
---|---|
<se:json /> |
Parameters
Name | Data Type | Properties | Description |
---|---|---|---|
Id | String |
MustBeAttribute
Trim |
Sets the Id of the macro. Macros with Ids set can be accessed using Viper by referring to page.[id].[methodname()]. |
InputData | Any | - | Sets the input data (Json). |
Source | String |
Default
|
Sets the source of the JSON object. |
UseXmlDates | Boolean | - | Determines how the Json object serializes dates. If true, an Xml DateTime literal is used, otherwise a JavaScript new Date constructor is used. |
Shared Parameters
Local Viper Methods
Viper | Extension | Description |
---|---|---|
This.Add | ✓ | Add a named property on the JSON object. Fails if the object already contains a property by the same name. |
This.AddNull | ✓ | Add a null property on the JSON object. Fails if the object already contains a property by the same name. |
This.AddValue | ✓ | Add a named property on the JSON object. Fails if the object already contains a property by the same name. |
This.ClearForcedResult |
Sets the result of the macro. used to override the normal handling of the result creation. |
|
This.Exists | ✓ | Indicates whether the given property exists in the JSON object. |
This.Get | ✓ | Gets the string representation of the JSON object. |
This.GetByPosition | ✓ | Gets the string representation of the JSON object at the given position. |
This.GetEncoded | ✓ | Gets the string representation of the JSON object and encodes ampersands for use on the client. |
This.GetEncodedValue | ✓ | Gets the typed value of a named property from the JSON object. If the typed value is a string ampersands will be encoded for use on the client. |
This.GetForcedResult | Gets the forced result of the macro, set by overriding the normal rendering using SetForcedResult(). | |
This.GetJson | ✓ | Gets the json object for later use. |
This.GetJsonTypeName | ✓ | Gets the type of the JSON object. |
This.GetJsonTypeName | ✓ | Gets the type of a named property from the JSON object. |
This.GetNameByPosition | ✓ | Gets the property name by position. |
This.GetValue | ✓ | Gets the typed value of a named property from the JSON object. |
This.GetValueByPosition | ✓ | Gets the typed property by position. |
This.Length | ✓ | Gets the number of properties on the outer JSON object. |
This.Load | ✓ | Loads the given string into the JSON object. Destroys the existing object. |
This.MimeType | ✓ | Returns the MIME type for a request or response that uses JSON. |
This.Remove | ✓ | Removes a property from the JSON object. |
This.RenderTime | ✓ | Returns the render time of the macro in milliseconds. |
This.Set | ✓ | Sets a named property on the JSON object. |
This.SetForcedResult |
Sets the result of the macro. used to override the normal handling of the result creation. |
|
This.SetNull | ✓ | Sets a named property on the JSON object to Null. |
This.SetValue | ✓ | Sets a named property on the JSON object. |