rcdmk / aspJSON

A fast classic ASP JSON parser and encoder for easy JSON manipulation to work with the new JavaScript MV* libraries and frameworks.
MIT License
204 stars 89 forks source link

Array not closed correctly in parse method #68

Closed smukkekim closed 6 years ago

smukkekim commented 6 years ago

When I run the parse method on the following:

{
   "weekly":{
      "active":true,
      "count":1,
      "weekdays":[0,1]
   },
   "monthly":{
      "active":false,
      "day":{
         "active":false,
         "dayCount":1,
         "monthCount":1
      },
      "weekday":{
         "active":false,
         "index":1,
         "weekday":0,
         "monthCount":1
      }
   }
}

Everything from "monthly" and on becomes a third element in the "weekdays"-array, rather than a second object on the same level as "weekly"

rcdmk commented 6 years ago

Hi. I'll take a look into this until Sunday. Thank you.

rcdmk commented 6 years ago

Hi. I've tested this string with correct escaping in the latest version and it works as expected. Are you running an older version of this script?

<!--#include file="jsonObject.class.asp" -->
<%
jsonString = "{""weekly"":{""active"":true,""count"":1,""weekdays"":[0,1]},""monthly"":{""active"":false,""day"":{""active"":false,""dayCount"":1,""monthCount"":1},""weekday"":{""active"":false,""index"":1,""weekday"":0,""monthCount"":1}}}"

set jsonObj = new JSONobject
set outputObj = jsonObj.parse(jsonString)
%>
<h3>Parse Output</h3>
<pre><%= outputObj.Serialize() %></pre>
smukkekim commented 6 years ago

Hi! I was using version 3.7 at the time of writing I've updated to the new version 3.8.1, and it seems to work now. Thanks!