I agree with the strawman proposal. In that proposal, what would you use in place of GoStruct3?
Also, is there a "json path" spec we can simply adhere to? or do we simply try to get as close to a JS expression as we reasonably can?
cc @cuonglm who worked on the original feature. I did think about proposing to make it more consistent with slices and such, but at the end of the day I thought the addition was already a big step forward.
Also, is there a "json path" spec we can simply adhere to?
One option is RFC 6901, which uses / instead of . as the delimiter. This would be the visual difference between .fooName["quoted/name"].barName and /fooName/quoted~1Name/barName/5. I kind of like the simplicity and visual aesthetics of this. It only requires escaping of the ~ and / as ~0 and ~1 respectively (note that ASCII control characters in U+0000 to U+0020 are left as is).
do we simply try to get as close to a JS expression as we reasonably can?
The grammar for a JS identifier is pretty complicated. Fortunately, the Go identifier grammar is a strict subset of the JS identifier grammar, so we could just use that as a shortcut.