Tcl Library Source Code

View Ticket
Login
Ticket UUID: 2aa0cebb889ae4be81c161f00ece4d067f4ecdd5
Title: json::json2dict treats null as a string
Type: Bug Version: 1.3.3
Submitter: Siqsuruq Created on: 2021-04-27 19:23:45
Subsystem: json Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2021-04-27 19:23:45
Resolution: None Closed By: nobody
    Closed on:
Description:

I'm using TclLib JSON package to convert JSON to Tcl dict but getting wrong results processing null values. According to JSON documentation null is a null value and "null" is a string, but json2dict will produce string from null instead of empty value. For example this json:

{
  "tbl_row_id": 1,
  "id": 35,
  "uuid_client": "0e9ce22d-2228-4a20-81d6-82985aaab9f6",
  "name": "Hirondina Maria Gomes Santos",
  "contact": null,
  "address": "Escola João José dos Santos - São Vicente",
  "country": null,
  "phone": "2317770 - 5809927",
  "email": null,
  "web": null,
  "fin": null,
  "details": null,
  "extra": {
    "bank": "BCA",
    "bank_account": "16343143"
  }
}
Will produce this dict:
tbl_row_id 1 id 35 uuid_client 0e9ce22d-2228-4a20-81d6-82985aaab9f6 name {Hirondina Maria Gomes Santos} contact null address {Escola João José dos Santos - São Vicente} country null phone {2317770 - 5809927} email null web null fin null details null extra {bank BCA bank_account 16343143}
Instead of:
tbl_row_id 1 id 35 uuid_client 0e9ce22d-2228-4a20-81d6-82985aaab9f6 name {Hirondina Maria Gomes Santos} contact "" address {Escola João José dos Santos - São Vicente} country "" phone {2317770 - 5809927} email "" web "" fin "" details "" extra {bank BCA bank_account 16343143}