Amazon.DynamoDBv2.DocumentModel.JsonUtils.FromJson C# (CSharp) Метод

FromJson() публичный статический Метод

Parses JSON text to produce Document.
public static FromJson ( string jsonText ) : Document
jsonText string
Результат Document
        public static Document FromJson(string jsonText)
        {
            var json = JsonMapper.ToObject(jsonText);
            if (!json.IsObject)
                throw new InvalidOperationException("Expected object at JSON root.");

            var document = ToEntry(json, DynamoDBEntryConversion.V2) as Document;
            if (document == null)
                throw new InvalidOperationException();

            return document;
        }

Usage Example

 /// <summary>
 /// Creates a document from a JSON string.
 /// The conversion is as follows:
 ///  Objects are converted to DynamoDB M types.
 ///  Arrays are converted to DynamoDB L types.
 ///  Boolean types are converted to DynamoDB BOOL types.
 ///  Null values are converted to DynamoDB NULL types.
 ///  Numerics are converted to DynamoDB N types.
 ///  Strings are converted to DynamoDB S types.
 /// </summary>
 /// <param name="json">JSON string.</param>
 /// <returns>Document representing the JSON data.</returns>
 public static Document FromJson(string json)
 {
     return(JsonUtils.FromJson(json));
 }