Skip to content

Commit

Permalink
Fix J string marshalling (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
glossd authored Nov 11, 2024
1 parent 23b4dc5 commit 5058021
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions j_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 2 additions & 0 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5058021

Please sign in to comment.