Aerospike.Database.LINQPadDriver.Extensions Namespace
Aerospike LINDPad Driver

ARecord..::..ToJson Method

Returns a JObject representing the record as JSON. Each property name will be the corresponding bin name. The primary key is the PK value or the digest()()()() if the PK Value is not provided/present.

Namespace:  Aerospike.Database.LINQPadDriver.Extensions
Assembly:  Aerospike.Database.LINQPadDriver (in Aerospike.Database.LINQPadDriver.dll)

Syntax


public JObject ToJson(
	string pkPropertyName,
	bool useDigest
)

Parameters

pkPropertyName
Type: String
The property name used for the primary key. The default is '_id'. If the primary key value is not present, the digest is used. In these cases the property value will be a sub property where that name will be '$oid' and the value is a byte string. If this is null, no PK property is written.
useDigest
Type: Boolean
If true, always use the PK digest as the primary key. If false, use the PK value is present, otherwise use the digest. Default is false.

Return Value

Returns a JObject representing the record.

Examples


C#
{
     "_id": 522,
     "Tag": "Player",
     "PlayerId": 522,
     "UserName": "Roberts.Eunice",
     "FirstName": "Eunice",
     "LastName": "Roberts",
     "EmailAddress": "RobertsEunice52@prohaska.name",
     "CountryCode": "US",
     "State": "NJ"
}
When useDigest is true:
C#
{
     "_id": {
       "$oid": "0080a245fabe57999707dc41ced60edc4ac7ac40"
     },
     "Tag": "Player",
     "PlayerId": 522,
     "UserName": "Roberts.Eunice",
     "FirstName": "Eunice",
     "LastName": "Roberts",
     "EmailAddress": "RobertsEunice52@prohaska.name",
     "CountryCode": "US",
     "State": "NJ"
}