-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Found an issue where i would create a JSONArray object then push JSONObjects to it, then ultimately serialize in the end. It would work, but further down the code where i want to again parse a whole new json string using JSONObject.parse, I would get a "A property already exists with the name: " even though there was only one property with that name.
Example code that broke:
set JSONLDArray = new JSONArray 'SEEMS TO BE THE PROBLEMATIC LINE
set JSONLDBreadcrumbItem = New JSONobject
JSONLDBreadcrumbItem.add "@type","ListItem"
JSONLDBreadcrumbItem.add "position",1
JSONLDBreadcrumbItem.add "name","Home"
JSONLDBreadcrumbItem.add "item",siteurl
JSONLDArray.push JSONLDBreadcrumbItem
set JSONLDBreadcrumbItem = nothing
set rsBreadcrumb = conn.Execute(SQL)
if not rsBreadcrumb.EOF then
BCProductPageID = rsBreadcrumb("ProductPageID")
BCProductName = rsBreadcrumb("ProductName")
BCWebmodulenumber = rsBreadcrumb("WebModuleRefID")
if isNull(BCWebmodulenumber) then BCWebmodulenumber = 0
BCDepartmentName = rsBreadcrumb("depz")
BCCategoryName = rsBreadcrumb("catnamez")
BCTypeName = rsBreadcrumb("typex")
BCDepartmentID = rsBreadcrumb("ProductDepartmentID")
BCCategoryID = rsBreadcrumb("ProductCategoryID")
BCTypeID = rsBreadcrumb("ProductTypeID")
set JSONLDBreadcrumbItem = New JSONobject
JSONLDBreadcrumbItem.add "@type","ListItem"
JSONLDBreadcrumbItem.add "position",2
JSONLDBreadcrumbItem.add "name",BCDepartmentName
JSONLDBreadcrumbItem.add "item",pageurl&"?cid="&BCDepartmentID&"&c1="&BCDepartmentName&"&N="&BCWebmodulenumber
JSONLDArray.push JSONLDBreadcrumbItem
set JSONLDBreadcrumbItem = nothing
end if
rsBreadcrumb.close
set rsBreadcrumb = nothing
set JSONLDBreadcrumbList = New JSONobject
JSONLDBreadcrumbList.add "@context","https://schema.org"
JSONLDBreadcrumbList.add "@type","BreadcrumbList"
JSONLDBreadcrumbList.add "itemListElement",JSONLDArray
response.write("<script type=""application/ld+json"">" & Replace(Replace(JSONLDBreadcrumbList.serialize(),"\/\/","//"),"\/","/") & "</script>")
set JSONLDBreadcrumbList = nothing
Set obj = new JSONobject
obj.Parse("{""test"":[{""hello"":""world""},{""abc"":123}]}") 'IT BREAKS HERE WITH ERROR "A property already exists with the name: test."
Metadata
Metadata
Assignees
Labels
No labels