#388·gjson

Question on joining as one string

Author: isycaCreated Nov 25, 2025Updated Nov 25, 2025

Sorry. i cannot find any discussion / discord.

	json := `{
		"name": {"first": "Tom", "last": "Anderson"},
		"age":37,
		"children": ["Sara","Alex","Jack"],
		"fav.movie": "Deer Hunter",
		"friends": [
			{"first": "Dale", "last": "Murphy", "age": 44, "nets": ["ig", "fb", "tw"]},
			{"first": "Roger", "last": "Craig", "age": 68, "nets": ["fb", "tw"]},
			{"first": "Jane", "last": "Murphy", "age": 47, "nets": ["ig", "tw"]}
		]
	}`

	value := gjson.Get(json, "name.first|@join|age")
	println(value.String()) 	// this prints nothing. I am looking to print it "Tom37" just like below
	
	val1 := gjson.Get(json, "name.first")
	val2 := gjson.Get(json, "age")
	println(val1.String()+ val2.String())

I am looking for a single path that will result to (in this example) "Tom37"

Thanks.