Array strings - #180
Array strings#180floren wants to merge 7 commits into
Conversation
|
PTAL |
|
PTAL. |
|
Hello, Is there anything I can do to help get this PR merged? |
|
PTAL |
|
any update here? I am using a fork with the above patch, would love to remove a replace directive from my go.mod if possible. The code looks solid and I have tested it a ton. |
|
Do we know why this is left open? Seems that it would be a fix for this: grafana/loki#9179 |
|
@buger Hello, can you have a look at this fix? Thanks in advance |
|
Hello, any news? |
|
@buger This PR being now almost 5 years old, I'm making one last check to see if you have any interest in merging it; if not, I'll transition our code to using my fork. Thank you! |
…nhancements Module renamed from github.com/buger/jsonparser to github.com/securityguy/jsonparser. Security fixes: - Fix GO-2026-4514: Delete() panics on malformed JSON (negative slice index DoS) - Update Dockerfile base image from golang:1.6 to golang:1.21 Bug fixes: - Fix EachKey failing to extract values from arrays of strings (PR buger#180) - Remove duplicate import in parser_test.go (PR buger#263) New APIs (all additive): - ArrayEach callback now accepts *error for early termination; DoneError sentinel added (PR buger#134) - DeleteOnOrig: in-place deletion variant with no allocation (PR buger#256) - ArrayIterator: lazy closure-based array iteration (PR buger#254) - GetRaw, EachRawKey: raw JSON byte extraction without type parsing (PR buger#250) Other: - go.mod bumped to go 1.18 - benchmark/go.mod updated with replace directive pointing to local module - CLAUDE.md added for Claude Code guidance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Closing — the EachKey array-of-strings bug this PR addresses is the same issue as #232, which was fixed in v1.3.1. EachKey now descends into terminal array-index paths consistently with Get. The fix was verified with |
Description:
In master, EachKey cannot extract from an array of strings. Specifying
foo.[0]would return nothing for{"foo": ["a","b"]}, because EachKey calls the Get function twice and in the case of strings inside arrays, the first Get strips quotes and the second then cannot recognize that it has been passed a string.This PR appears to make extraction from arrays of strings work properly without breaking any existing tests. It includes a test which failed on master but passes with the changes.
Benchmark before change: Neither benchmark worked: