JSON Variables Don't Work with Null Column Values in Examples Table
See original GitHub issueThe demo example for passing null in an Examples table requires designating the example value with single quotes '<exampleEntry>'
. When a variable is passed in a JSON body it’s set as '#(variable)'
, so requiring additional single quotes changes it from a variable to a string. And if the quotes are not used, just the angle brackets <exampleEntry>
, a parsing error is thrown because the value is seen as not existing.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
JSON Variables Don't Work with Null Column Values ... - GitHub
A clean fix to this would be to allow passing an Examples column as an optional field. Such that when passing something like...
Read more >JSON to data table: how to avoid NULL columns being ...
The issue: if any keys in the JSON have all NULL values, they are not included in the data table (i.e., no columns...
Read more >How to check if null values present in JSON object column in ...
SELECT * FROM json_data WHERE LOWER(FORMAT('%t', col1)) != 'null';. Note FORMAT() turns null into NULL string.
Read more >Handling JSON null and empty arrays and objects - IBM
Handling null and empty arrays and objects used in JSON data is described. JSON data has the concept of null and empty arrays...
Read more >Include Null Values in JSON - SQL Server - Microsoft Learn
If you don't specify the INCLUDE_NULL_VALUES option, the JSON output doesn't include properties for values that are null in the query results.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
One feature that I think would be beneficial would be a marker entry in tables #omit that would cause that k/v pair to be omitted from the generated JSON. So the following table:
Would then be translated into the following JSON:
The absence of keys in an object is a different test to the key being present with a null or empty value.
You are right. I swear I tried that format, but just tried again, and field is omitted. Also takes care of formatting, as field I marked optional was last field in the body, so took care of comma being removed for the NOW last request field. Awesome!!