public QueryExpression FromJson(string json) { IReferenceResolver resolver = new QueryReferenceResolver(); settings.ReferenceResolverProvider = () => { return(resolver); }; settings.Context = new StreamingContext(StreamingContextStates.Other, resolver); return(JsonConvert.DeserializeObject <QueryExpression>(json, settings)); }
public string ToJson(QueryExpression query) { IReferenceResolver resolver = new QueryReferenceResolver(); settings.ReferenceResolverProvider = () => { return(resolver); }; settings.Context = new StreamingContext(StreamingContextStates.Other, resolver); return(JsonConvert.SerializeObject(query, settings)); }