[Gambas-user] Issue 473 in gambas: JSON Encode/Decode: JSONObject -> Collection drops relevant empty strings/null values from input request.

gambas at ...2524... gambas at ...2524...
Thu Oct 31 11:09:21 CET 2013


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 473 by uAle... at ...626...: JSON Encode/Decode: JSONObject ->  
Collection drops relevant empty strings/null values from input request.
http://code.google.com/p/gambas/issues/detail?id=473

1) Describe the problem.

Gambas has the very nice and handy JSON.Encode and JSON.Decode  
functionality, but it doesn't work "good" enough for Object -> Collection  
types. Within an object you can specify empty strings or null values, which  
are lost in the Gambas Collection conversion.

If the following JSON is send:
{"test1": "data1", "test2": ""}

This will result in a Collection of only:
collection["test1"] = "data"

The "test2" is lost during the encoding! This also applies when you do a  
JSON.Encode of a collection.

I know that the wiki (http://gambasdoc.org/help/comp/gb/collection?v3)  
describes the following:
- If assigning NULL values to the variant value, the key is removed from  
the collection
- Also Gambas handles an empty string as NULL, so assigning an empty string  
will remove the key also from the collection

Within the JSON specification, the following data-types are supported:
     string
     number
     object - this consists again of an array/string/number/boolean/null
     array
     true
     false
     null

Only we loose relevant empty strings and null values when you decode/encode  
objects. This is a bug or as designed? This seem to go against the JSON  
specification?

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: 3.xx & TRUNK
Revision: r1234 (if you use a development version)
Operating system: Any
Distribution: Any
Architecture: Any
GUI component: Any
Desktop used: Any

3) Provide a little project that reproduces the bug or the crash.

See attached

4) If your project needs a database, try to provide it, or part of it.

5) Explain clearly how to reproduce the bug or the crash.

See description.

6) By doing that carefully, you have done 50% of the bug fix job!

IMPORTANT NOTE: if you encounter several different problems or bugs, (for
example, a bug in your project, and an interpreter crash while debugging
it), please create distinct issues!


Attachments:
	Test.tar.gz  5.0 KB

-- 
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings




More information about the User mailing list