How can i get an empty string instead of null

Help
Hafeyang
2009-04-09
2013-04-29
  • Hafeyang

    Hafeyang - 2009-04-09

    When I declare a map and put a null value like below:

            Map map =new HashMap();
            map.put("nullval",null);
            JSONObject o =JSONObject.fromObject(map);
            System.out.println(o.toString(0));

    i get a json {"nullval":null}

    But I want to get {"nullval":""}

    I tried to registerJsonValueProcessor(Object.class,...) but none of use;

    Thanks a lot!

     
    • Hafeyang

      Hafeyang - 2009-04-09

      I forget to say I use jdk1.4

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks