gjson icon indicating copy to clipboard operation
gjson copied to clipboard

How to convert []Result to json string ?

Open Jamlee opened this issue 5 years ago • 3 comments

How to convert []Result to json string ?

Jamlee avatar Jun 08 '20 12:06 Jamlee

.String()

evan-sm avatar Jun 14 '20 15:06 evan-sm

is the array has .String() method ? @wMw9

Jamlee avatar Jun 15 '20 01:06 Jamlee

Pretty basic stuff but I'll play along.

// Assuming targeting list
var myResults gjson.Result

for _, r := range myResults.Array() {
	myString := r.String()
	fmt.Println(myString)
}

You may need to read up on the result type methods, they will guide you...

ozburo avatar Jul 20 '20 15:07 ozburo