hedhyw / json-log-viewer

Interactive viewer for JSON logs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicated name-value pairs in JSON object view

ctschacher opened this issue · comments

Sometimes there are name-value pairs that appear twice in the JSON view that you get when choosing a log entry from the initial screen.

This is how it looks in the original JSON log:

{
  "level": "info",
  "timestamp": 1712434850.7363865,
  "message": "Resolving API context",
  "controller": "apidefinition",
  "controllerGroup": "dummyGroup",
  "controllerKind": "ApiDefinition",
  "ApiDefinition": {
    "name": "ct-echo2",
    "namespace": "dummy-ns"
  },
  "namespace": "dummy-ns",
  "name": "service-account",
  "reconcileID": "f9e8c97a-e7ea-4e23-a9a0-d2bbd5acd569"
}

And this is how the json-log-viewer dispays it:

{
  "level": "info",
  "timestamp": 1712434850.7363865,
  "message": "Resolving API context",
  "controller": "apidefinition",
  "controllerGroup": "dummyGroup",
  "controllerKind": "ApiDefinition",
  "ApiDefinition": {
    "name": "ct-echo2",
    "namespace": "dummy-ns"
  },
  "namespace": "dummy-ns",
  "name": "ct-echo2",
  "reconcileID": "f9e8c97a-e7ea-4e23-a9a0-d2bbd5acd569",
  "namespace": "dummy-ns",
  "name": "service-account"
}

In this example the "name": "ct-echo2" and "namespace": "dummy-ns" from the ApiDefinition object were copied to the root level.

Hello, can you please include log-file to reproduce it?

I've tried:

test.log

{"level":"info","timestamp":1712434850.7363865,"message":"Resolving API context","controller":"apidefinition","controllerGroup":"dummyGroup","controllerKind":"ApiDefinition","ApiDefinition":{"name":"ct-echo2","namespace":"dummy-ns"},"namespace":"dummy-ns","name":"service-account","reconcileID":"f9e8c97a-e7ea-4e23-a9a0-d2bbd5acd569"}

jlv@0.2.4 test.log

image

Thanks for the issue!

Closed due to inactivity