Beispiel #1
0
        /// <summary>
        /// Deserialize the json to the desired object
        /// </summary>
        /// <param name="json">The json to be deserialized</param>
        /// <param name="dataType">The type of the desired object</param>
        /// <returns>The desired object instance</returns>
        public static Object Deserialize(String json, Type dataType)
        {
            LazyJson lazyJson = LazyJsonReader.Read(json);

            return(DeserializeToken(lazyJson.Root, dataType));
        }
Beispiel #2
0
 /// <summary>
 /// Add a new token to the array
 /// </summary>
 /// <param name="json">The json that will be transformed on the desired token</param>
 public void Add(String json)
 {
     this.TokenList.Add(LazyJsonReader.Read(json).Root);
 }
Beispiel #3
0
 /// <summary>
 /// Add a new property to the object
 /// </summary>
 /// <param name="name">The property name</param>
 /// <param name="json">The json that will be transformed on the desired token</param>
 public void Add(String name, String json)
 {
     this[name] = new LazyJsonProperty(name, LazyJsonReader.Read(json).Root);
 }
Beispiel #4
0
 /// <summary>
 /// Append a json token at specified jPath
 /// </summary>
 /// <param name="jPath">The jPath location to append the token</param>
 /// <param name="json">The json that will be transformed on the desired token</param>
 public void AppendToken(String jPath, String json)
 {
     AppendToken(jPath, LazyJsonReader.Read(json).Root);
 }
Beispiel #5
0
 /// <summary>
 /// Append a json property at specified jPath object
 /// </summary>
 /// <param name="jPath">The jPath object location to append the property</param>
 /// <param name="name">The property name</param>
 /// <param name="json">The json that will be transformed on the desired property token</param>
 public void AppendProperty(String jPath, String name, String json)
 {
     AppendToken(String.Join('.', jPath, name != null ? name : LazyJson.UNNAMED_PROPERTY), LazyJsonReader.Read(json).Root);
 }
Beispiel #6
0
 /// <summary>
 /// Append a token at root
 /// </summary>
 /// <param name="json">The json that will be transformed on the desired token</param>
 public void AppendRoot(String json)
 {
     AppendToken("$", LazyJsonReader.Read(json).Root);
 }