Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/JSON/ColdFusion/json.cfm
Normal file
20
Task/JSON/ColdFusion/json.cfm
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!--- Create sample JSON structure --->
|
||||
<cfset json = {
|
||||
string: "Hello",
|
||||
number: 42,
|
||||
arrayOfNumbers: [1, 2, 3, 4],
|
||||
arrayOfStrings: ["One", "Two", "Three", "Four"],
|
||||
arrayOfAnything: [1, "One", [1, "One"], { one: 1 }],
|
||||
object: {
|
||||
key: "value"
|
||||
}
|
||||
} />
|
||||
|
||||
<!--- Convert to JSON string --->
|
||||
<cfset jsonSerialized = serializeJSON(json) />
|
||||
<!--- Convert back to ColdFusion --->
|
||||
<cfset jsonDeserialized = deserializeJSON(jsonSerialized) />
|
||||
|
||||
<!--- Output examples --->
|
||||
<cfdump var="#jsonSerialized#" />
|
||||
<cfdump var="#jsonDeserialized#" />
|
||||
Loading…
Add table
Add a link
Reference in a new issue