Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Java
  4. Serializing null

Serializing null

Scheduled Pinned Locked Moved Java
javajsonhelptutorialquestion
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    ZawMinTun
    wrote on last edited by
    #1

    Hello everyone, Is it possible to serialize null as just null in java? For example, if I have a row such as below, Col1 Col2 Col3 ---- ---- ---- A null B Is it possible to seriazle the row above to the json below? {"Col1":"A", "Col2":null, "Col3":"B"} Thanks for taking your time and help a lot. Best regards, Zaw Min Tun

    L 1 Reply Last reply
    0
    • Z ZawMinTun

      Hello everyone, Is it possible to serialize null as just null in java? For example, if I have a row such as below, Col1 Col2 Col3 ---- ---- ---- A null B Is it possible to seriazle the row above to the json below? {"Col1":"A", "Col2":null, "Col3":"B"} Thanks for taking your time and help a lot. Best regards, Zaw Min Tun

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I think this question belongs at http://www.codeproject.com/Forums/1580226/JavaScript.aspx[^].

      Z J 2 Replies Last reply
      0
      • L Lost User

        I think this question belongs at http://www.codeproject.com/Forums/1580226/JavaScript.aspx[^].

        Z Offline
        Z Offline
        ZawMinTun
        wrote on last edited by
        #3

        In fact, I'm doing this in Java, it's a Maven project and hosted as a web service on GlassFish. The service returns the data in json format. The problem is when the values are null, I have to serialize them as "" or "null". I want to return as just null. However, I still can't find a way.

        L 1 Reply Last reply
        0
        • Z ZawMinTun

          In fact, I'm doing this in Java, it's a Maven project and hosted as a web service on GlassFish. The service returns the data in json format. The problem is when the values are null, I have to serialize them as "" or "null". I want to return as just null. However, I still can't find a way.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          See http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r1mx/index.jsp?topic=/com.ibm.wbit.610.help.config.doc/topics/rjsonnullunsempprops.html[^].

          J Z 2 Replies Last reply
          0
          • L Lost User

            See http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r1mx/index.jsp?topic=/com.ibm.wbit.610.help.config.doc/topics/rjsonnullunsempprops.html[^].

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            Nice link

            1 Reply Last reply
            0
            • L Lost User

              I think this question belongs at http://www.codeproject.com/Forums/1580226/JavaScript.aspx[^].

              J Offline
              J Offline
              jschell
              wrote on last edited by
              #6

              Just noting that I do JSON all the time and I definitely do not program in javascript. I use it in Java and C#.

              L 1 Reply Last reply
              0
              • J jschell

                Just noting that I do JSON all the time and I definitely do not program in javascript. I use it in Java and C#.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Thanks for the information. About the only thing I know about it is what JSON actually stands for, which, according to http://json.org/[^], is JavaScript Object Notation.

                J 1 Reply Last reply
                0
                • L Lost User

                  Thanks for the information. About the only thing I know about it is what JSON actually stands for, which, according to http://json.org/[^], is JavaScript Object Notation.

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #8

                  Richard MacCutchan wrote:

                  JavaScript Object Notation

                  lol...I had no idea what it stands for despite using it for quite some time.

                  L 1 Reply Last reply
                  0
                  • J jschell

                    Richard MacCutchan wrote:

                    JavaScript Object Notation

                    lol...I had no idea what it stands for despite using it for quite some time.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    :wtf: and you're one of my CodeProject heroes.

                    1 Reply Last reply
                    0
                    • L Lost User

                      See http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r1mx/index.jsp?topic=/com.ibm.wbit.610.help.config.doc/topics/rjsonnullunsempprops.html[^].

                      Z Offline
                      Z Offline
                      ZawMinTun
                      wrote on last edited by
                      #10

                      Thanks a lot for this useful information.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups