[Gambas Bug Tracker] Bug #1130: JSON.Encode serializes null objects as "undefined"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1130: JSON.Encode serializes null objects as "undefined"

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1130&from=L21haW4-

Adrien PROKOPOWICZ reported a new bug.

Summary
-------

JSON.Encode serializes null objects as "undefined"

Type             : Bug
Priority         : Medium
Gambas version   : 3.9.90 (TRUNK)
Product          : Web components


Description
-----------

See example code here : https://gambas-playground.proko.eu/?gist=b70e4b4d0d25d56ba10b1d1ddb6ebfea

If I give JSON.Encode() a Null value (or Variant) it correctly serializes it as `null`.
However if I give it a Null object reference, it gets serialized as `undefined`.

Which is surprising, but more importantly it is incorrect as there is no `undefined` in JSON.


System information
------------------

[System]
Gambas=3.9.90 r8147
OperatingSystem=Linux
Kernel=4.11.9-1-ARCH
Architecture=x86_64
Distribution=Arch Linux
Desktop=KDE5
Theme=Breeze
Language=fr_FR.UTF-8
Memory=15965M

[Libraries]
Cairo=libcairo.so.2.11400.10
Curl=libcurl.so.4.0.0
Curl=libcurl.so.4.1.0
Curl=libcurl.so.4.2.0
Curl=libcurl.so.4.3.0
Curl=libcurl.so.4.4.0
DBus=libdbus-1.so.3.14.11
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.1202.0
GTK+2=libgtk-x11-2.0.so.0.2400.31
GTK+3=libgtk-3.so.0.2200.16
OpenGL=libGL.so.1.0.0
Poppler=libpoppler.so.67.0.0
QT4=libQtCore.so.4.8.7
QT5=libQt5Core.so.5.9.1
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
ANT_HOME=/usr/share/apache-ant
COGL_ATLAS_DEFAULT_BLIT_MODE=framebuffer
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=/usr/share/xsessions/plasma
DISPLAY=:0
GB_GUI=gb.qt5
GEM_HOME=<home>/.rvm/gems/ruby-2.3.3
GEM_PATH=<home>/.rvm/gems/ruby-2.3.3:<home>/.rvm/gems/ruby-2.3.3@global
GRADLE_HOME=/usr/share/java/gradle
GS_LIB=<home>/.fonts
GTK_MODULES=canberra-gtk-module
HOME=<home>
IRBRC=<home>/.rvm/rubies/ruby-2.3.3/.irbrc
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=fr_FR.UTF-8
LANGUAGE=
LOGNAME=<user>
MAIL=/var/spool/mail/<user>
MAVEN_OPTS=-Xmx512m
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MY_RUBY_HOME=<home>/.rvm/rubies/ruby-2.3.3
OLDPWD=<home>
PATH=<home>/.rvm/gems/ruby-2.3.3/bin:<home>/.rvm/gems/ruby-2.3.3@global/bin:<home>/.rvm/rubies/ruby-2.3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:<home>/.rvm/bin
PT5HOME=/opt/pt
PWD=<home>
QSG_RENDER_LOOP=
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_NO_GLIB=1
QT_QUICK_CONTROLS_STYLE=org.kde.desktop
RUBY_VERSION=ruby-2.3.3
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/584,unix/<hostname>:/tmp/.ICE-unix/584
SHELL=/usr/bin/zsh
SHLVL=1
TZ=:/etc/localtime
USER=<user>
XAUTHORITY=<home>/.Xauthority
XCURSOR_SIZE=0
XCURSOR_THEME=breeze_cursors
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=c2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=1
_=/usr/bin/kwrapper5
__GL_SYNC_TO_VBLANK=1
_system_arch=x86_64
_system_name=Arch
_system_type=Linux
_system_version=libc-2.25
rvm_bin_path=<home>/.rvm/bin
rvm_path=<home>/.rvm
rvm_prefix=<home>
rvm_version=1.27.0 (latest)



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Serialization Database query result

Hans Lehmann
Hello.

What is the possibility to serialize the result of a database query
(data type result)?
Every idea and approach is welcome.

Sincerely
Hans
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serialization Database query result

PICCORO McKAY Lenz
errr with json?

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-29 14:28 GMT-04:00 Hans Lehmann <[hidden email]>:

> Hello.
>
> What is the possibility to serialize the result of a database query (data
> type result)?
> Every idea and approach is welcome.
>
> Sincerely
> Hans
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...