O
O
onlinejunior2020-05-25 10:08:04
go
onlinejunior, 2020-05-25 10:08:04

Is there an alternative to json string comparison in golang?

Now I'm comparing like this:

json.NewDecoder(strings.NewReader(js)).Decode(&m)
  for i := range m.Array {
  if m.Array[i].Extend == "test" {
    fmt.Printf("1")
    return
  }

  }


is there a better solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
falconandy, 2020-05-26
@falconandy

Maybe github.com/tidwall/gjson (query an array)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question