azos icon indicating copy to clipboard operation
azos copied to clipboard

JSON Deserialization Error details to see what caused the error

Open itadapter opened this issue 1 year ago • 2 comments

  • Add "near" snippet from lexer.
  • Add "path" from parser for example:
  Unterminated string at 56 line 3 near `[{days: [1,3], name: b` at doc path `{b{cars[#0{name`

given sample document:

{
  a: {name: Sidar, ocupation: butcher, salary: [10,20,{value: 35000, title: "horn"}]}
  b: {cars: [{days: [1,3], name: bui"lck}]},
}

A path captures:

  • Object start as {
  • Array as [
  • Array element as #n n is an zero-based index
  • Property as prop_ident

therefore, the malformed json form the above has a processing path of: **{b{cars[#0{name... **

We can use pre-allocated struct "stack buffer" for capturing JSOn syntax.

Add app-wide property json-serialization{ deserialization-error-dump-len=0..1024 }

itadapter avatar Feb 24 '23 20:02 itadapter