diff --git a/j_test.go b/j_test.go index 7bf5356..e6d5839 100644 --- a/j_test.go +++ b/j_test.go @@ -20,6 +20,7 @@ func TestJ_Q(t *testing.T) { {In: `{"num": 1}`, P: ".num", E: 1.0}, {In: `1`, P: ".", E: 1.0}, {In: `true`, P: ".", E: true}, + {In: `"hello"`, P: ".", E: "hello"}, {In: `{"sold": false}`, P: ".sold", E: false}, {In: `[1, 2, 3]`, P: ".[0]", E: 1.0}, {In: `[{"name":"Lola"}, {"name":"Buster"}]`, P: ".[1].name", E: "Buster"}, diff --git a/parse.go b/parse.go index 67246fe..5aa3dc6 100644 --- a/parse.go +++ b/parse.go @@ -59,6 +59,8 @@ func UnmarshalInto(j string, v any) error { rve.Set(reflect.ValueOf(B(u))) case float64: rve.Set(reflect.ValueOf(F(u))) + case string: + rve.Set(reflect.ValueOf(S(u))) case map[string]any: rve.Set(reflect.ValueOf(M(u))) case []any: