Skip to content

Commit

Permalink
add comment in skipStringValue
Browse files Browse the repository at this point in the history
  • Loading branch information
yosiat committed Oct 4, 2022
1 parent 67ea9c2 commit 4f2c49b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions flatten_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,15 @@ func (fj *flattenJSON) skipStringValue() error {
for i < len(data) {
c := data[i]

// Since we want to iterate until we found quote (") we need to take care
// about escaped quotes (\"), any other escaped characters is not relevant.
if c == '\\' && i+1 < len(data) && data[i+1] == '"' {
i = i + 2
continue
}

// If we found a quote, and it's not escaped (we check it above)
// we can finish processing.
if c == '"' {
fj.eventIndex = fj.eventIndex + i
return nil
Expand Down

0 comments on commit 4f2c49b

Please sign in to comment.