What is the JSP equivalent to json_encode ( in PHP )?

前端 未结 4 1656
孤街浪徒
孤街浪徒 2020-12-03 18:26

I am trying to encode a JSP servlet into JSON. What\'s the equivalent in JSP to json_encode() in PHP ?

4条回答
  •  暖寄归人
    2020-12-03 18:36

    Gson is pretty cool.

    Its almost the same as json_encode. Note that an encoded empty string in json_encodeevaluates to "\"\""

    In Gson it returns ""

提交回复
热议问题