Json.Encode Method
Converts a data object to a string that is in the JavaScript Object Notation (JSON) format.
Namespace: System.Web.Helpers
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
Syntax
'Declaration
Public Shared Function Encode ( _
value As Object _
) As String
'Usage
Dim value As Object
Dim returnValue As String
returnValue = Json.Encode(value)
public static string Encode(
Object value
)
public:
static String^ Encode(
Object^ value
)
static member Encode :
value:Object -> string
public static function Encode(
value : Object
) : String
Parameters
- value
Type: System.Object
The data object to convert.
Return Value
Type: System.String
Returns a string of data converted to the JSON format.
Remarks
Call the Encode method to convert a data object (for example, a set of data records that you return from a database query) to a string that is encoded in JSON format. You typically convert data objects to JSON format in order to work with the data as text in a web page by using JavaScript. This lets you create a page where users interact with the data in the browser without requiring round trips to the server.