Esempio n. 1
0
        ////////////////////////////////////////
        // 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());
            }
        });
Esempio n. 2
0
        ////////////////////////////////////////
        // ObjectToValue

        public static JsonValue ObjectToValue(object value) => JsonException.Wrap(() =>
        {
            return(ObjectParser.Parse(value));
        });
Esempio n. 3
0
 public static void ObjectToString(object value, TextWriter writer, bool formatted) => JsonException.Wrap(() =>
 {
     TextSerializer.Serialize(new ObjectItemizer(value), Constants.GetIndent(formatted), writer);
 });
Esempio n. 4
0
 public static void StringIntoObject(TextReader reader, object instance) => JsonException.Wrap(() =>
 {
     Deserializer.Deserialize(new TokenItemizer(new StreamTokenizer(reader)), instance, null);
 });
Esempio n. 5
0
 public static void StringIntoObject(string text, object instance) => JsonException.Wrap(() =>
 {
     Deserializer.Deserialize(new TokenItemizer(new StringTokenizer(text)), instance, null);
 });
Esempio n. 6
0
 public static object StringToObject(TextReader reader, Type type) => JsonException.Wrap(() =>
 {
     return(Deserializer.Deserialize(new TokenItemizer(new StreamTokenizer(reader)), null, type));
 });
Esempio n. 7
0
 public static object StringToObject(string text, Type type) => JsonException.Wrap(() =>
 {
     return(Deserializer.Deserialize(new TokenItemizer(new StringTokenizer(text)), null, type));
 });
Esempio n. 8
0
 public static JsonValue StringToValue(TextReader reader) => JsonException.Wrap(() =>
 {
     return(StreamParser.Parse(reader));
 });
Esempio n. 9
0
        ////////////////////////////////////////
        // StringToValue

        public static JsonValue StringToValue(string text) => JsonException.Wrap(() =>
        {
            return(StringParser.Parse(text));
        });
Esempio n. 10
0
 public static void StringToString(TextReader reader, TextWriter writer, bool formatted) => JsonException.Wrap(() =>
 {
     TextSerializer.Serialize(new TokenItemizer(new StreamTokenizer(reader)), Constants.GetIndent(formatted), writer);
 });
Esempio n. 11
0
 public void IntoObject(object instance) => JsonException.Wrap(() =>
 {
     Deserializer.Deserialize(new ParsedItemizer(this), instance, null);
 });
Esempio n. 12
0
 public object ToObject(Type type) => JsonException.Wrap(() =>
 {
     return(Deserializer.Deserialize(new ParsedItemizer(this), null, type));
 });
Esempio n. 13
0
 public void ToString(TextWriter writer, bool formatted) => JsonException.Wrap(() =>
 {
     TextSerializer.Serialize(new ParsedItemizer(this), Constants.GetIndent(formatted), writer);
 });
Esempio n. 14
0
 public JsonValue SelectOne(string path) => JsonException.Wrap(() =>
 {
     return(this.Select(path).Single());
 });