Description: |
The json::json2dict procedure is named and documented as if it produces a dictionary output in all cases. This is incorrect, as per these examples where the output is a string/number/list:
% package require json
1.3.3
% json::json2dict {true}
true
% json::json2dict {1234.45}
1234.45
% json::json2dict {"Hello, World!"}
Hello, World!
% json::json2dict {[1,2,3,4]}
1 2 3 4
The documentation (and ideally the name) should be updated to make clear that it only returns a dictionary if the input is a JSON object, and that the caller *must know* the type of JSON data being parsed in order to know how to interpret the result correctly. I have seen several questions on TkChat and c.l.t that suggest that this is confusing people.
|