Home > front end >  send undefined in jbuilder [rails]
send undefined in jbuilder [rails]

Time:10-18

how i can produce this json with the jbuilder DSL

{ data: undefined }

I think it is necessary to precise without explaining why that { data: null } or { } are not the same json as the first

CodePudding user response:

According to

It means that undefined is not supported by JSON

See also JSON site

In any case, sending undefined data from the backend to the frontend is quite strange. I believe that if there is such a need, it is better to use null value or even not send anything

  • Related