Converting JSON string to an array in ColdFusion MX7

不问归期 提交于 2019-12-02 03:35:28

The normal answer would be use the built-in deserializeJson function, but since that function wasn't available in CFMX7 (it arrived in CF8), you will need to use a UDF to achieve the same thing.

There are two sites which contain resources of this type, cflib.org and riaforge.org, each of which have a different potential solution for MX7.

Searching CFlib provides JsonDecode. (CFLib has a specific filter for "Maximum Required CF Version", so you can ensure any results that appear will work for your version.)

Searching riaforge provides JSONUtil, which runs on MX7 (but also claims better type mapping than the newer built-in functions).

Since MX7 runs on Java, you can likely also make use of any of the numerous Java libraries listed on json.org, using createObject/java.

Sam Farmer

JSON serialization was added natively in CF8.

If you are on MX7 look on riaforge.org for a library that will deSerialize JSON for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!