//////////////////////////////////////// // StringToString public static string StringToString(string text, bool formatted) => JsonException.Wrap(() => { using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture)) { TextSerializer.Serialize(new TokenItemizer(new StringTokenizer(text)), Constants.GetIndent(formatted), writer); return(writer.ToString()); } });
//////////////////////////////////////// // ObjectToValue public static JsonValue ObjectToValue(object value) => JsonException.Wrap(() => { return(ObjectParser.Parse(value)); });
public static void ObjectToString(object value, TextWriter writer, bool formatted) => JsonException.Wrap(() => { TextSerializer.Serialize(new ObjectItemizer(value), Constants.GetIndent(formatted), writer); });
public static void StringIntoObject(TextReader reader, object instance) => JsonException.Wrap(() => { Deserializer.Deserialize(new TokenItemizer(new StreamTokenizer(reader)), instance, null); });
public static void StringIntoObject(string text, object instance) => JsonException.Wrap(() => { Deserializer.Deserialize(new TokenItemizer(new StringTokenizer(text)), instance, null); });
public static object StringToObject(TextReader reader, Type type) => JsonException.Wrap(() => { return(Deserializer.Deserialize(new TokenItemizer(new StreamTokenizer(reader)), null, type)); });
public static object StringToObject(string text, Type type) => JsonException.Wrap(() => { return(Deserializer.Deserialize(new TokenItemizer(new StringTokenizer(text)), null, type)); });
public static JsonValue StringToValue(TextReader reader) => JsonException.Wrap(() => { return(StreamParser.Parse(reader)); });
//////////////////////////////////////// // StringToValue public static JsonValue StringToValue(string text) => JsonException.Wrap(() => { return(StringParser.Parse(text)); });
public static void StringToString(TextReader reader, TextWriter writer, bool formatted) => JsonException.Wrap(() => { TextSerializer.Serialize(new TokenItemizer(new StreamTokenizer(reader)), Constants.GetIndent(formatted), writer); });
public void IntoObject(object instance) => JsonException.Wrap(() => { Deserializer.Deserialize(new ParsedItemizer(this), instance, null); });
public object ToObject(Type type) => JsonException.Wrap(() => { return(Deserializer.Deserialize(new ParsedItemizer(this), null, type)); });
public void ToString(TextWriter writer, bool formatted) => JsonException.Wrap(() => { TextSerializer.Serialize(new ParsedItemizer(this), Constants.GetIndent(formatted), writer); });
public JsonValue SelectOne(string path) => JsonException.Wrap(() => { return(this.Select(path).Single()); });