fix lead comma error

This commit is contained in:
Josh Baker 2016-11-29 18:08:02 -07:00
parent 1a15b54bbb
commit 1303e83611
1 changed files with 3 additions and 2 deletions

View File

@ -1099,13 +1099,14 @@ func parseArray(c *parseContext, i int, path string) (int, bool) {
if rp.alogok { if rp.alogok {
var jsons = make([]byte, 0, 64) var jsons = make([]byte, 0, 64)
jsons = append(jsons, '[') jsons = append(jsons, '[')
for j := 0; j < len(alog); j++ { for j, k := 0, 0; j < len(alog); j++ {
res := Get(c.json[alog[j]:], rp.alogkey) res := Get(c.json[alog[j]:], rp.alogkey)
if res.Exists() { if res.Exists() {
if j > 0 { if k > 0 {
jsons = append(jsons, ',') jsons = append(jsons, ',')
} }
jsons = append(jsons, []byte(res.Raw)...) jsons = append(jsons, []byte(res.Raw)...)
k++
} }
} }
jsons = append(jsons, ']') jsons = append(jsons, ']')