Classic ASP
Classic ASP
Copy JSON Object from one JSON Array to Another
See more JSON Examples
Demonstrates how to copy an object in a JSON array to another JSON array.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set arr1 = Server.CreateObject("Chilkat.JsonArray")
set arr2 = Server.CreateObject("Chilkat.JsonArray")
s = "[{""a"":1}, {""b"":2}, {""c"":3}]"
sEmpty = "[]"
success = arr1.Load(s)
success = arr2.Load(sEmpty)
set jObj = Server.CreateObject("Chilkat.JsonObject")
success = arr1.ObjectAt2(1,jObj)
success = arr2.AddObjectCopyAt(-1,jObj)
Response.Write "<pre>" & Server.HTMLEncode( arr2.Emit()) & "</pre>"
' output is: [{"b":2}]
%>
</body>
</html>