在ColdFusion MX7中将JSON字符串转换为数组 [英] Converting JSON string to an array in ColdFusion MX7

查看:287
本文介绍了在ColdFusion MX7中将JSON字符串转换为数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个cookie值如:

I have a cookie value like:

"[{"index":"1","name":"TimePeriod","hidden":false},{"index":"2","name":"Enquiries","hidden":false},{"index":"3","name":"Online","hidden":false}]"

我想使用这个cookie值作为数组ColdFusion。

I would like to use this cookie value as an array in ColdFusion. What would be the best possible way to do this?

推荐答案

正常的答案是使用内置的 deserializeJson 功能,但由于该功能在CFMX7中不可用(它到达CF8),因此您需要使用UDF

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.

有两个网站包含此类型的资源, cflib。 org riaforge.org ,每个都有不同的MX7潜在解决方案。

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.

搜索 CFlib 提供 JsonDecode 。 (CFLib对最大所需CF版本有一个特定的过滤器,因此您可以确保显示的任何结果适用于您的版本。)

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.)

搜索 riaforge 提供 JSONUtil ,它在MX7(但也声称比新的内置函数更好的类型映射)。

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

由于MX7运行在Java上,你可能还可以使用任何大量的Java库在 json.org 上,使用 createObject / java

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.

这篇关于在ColdFusion MX7中将JSON字符串转换为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆