Comments (6)
Hi.
You can use the parse method to let the tools do the work for you:
Dim geometry, coordinates
Set geometry = new JSONObject
Set coordinates = new JSONObject
coordinates.parse(arrayDB) ' coordinates here will have a "data" property with your parsed jsonArray object
geometry.Add "type", "Polygon"
geometry.Add "coordinates", coordinates("data")
You could also set coordinates to the result of the parse:
'...
Set coordinates = new JSONObject
Set coordinates = coordinates.parse(arrayDB) ' coordinates here will be your parsed jsonArray object
geometry.Add "type", "Polygon"
geometry.Add "coordinates", coordinates
This two solutions would output the following when the serialize()
or write()
methods are called:
{"type":"Polygon","coordinates":[[[14.88,39.31],[14.88,39.31]]]}
from aspjson.
@rcdmk Using your example above, the result only produces ONE item from the array
[14.88,39.31]
{"type":"Polygon","coordinates":[14.88,39.31]}
from aspjson.
Mmmm...
I will need to take a look at this.
It must have worked the way I've showed you above.
I'll do some tests to find out what is going wrong.
from aspjson.
This is a real bug with the code.
I'll fix this as soon as possible.
In the meantime you can overcome this by wrapping the value in an object before parsing:
arrayDB = "{""value"":""[[[14.88,39.31],[14.88,39.31]]]""}"
coordinates.parse(arrayDB)
geometry.Add "coordinates", coordinates("value")
from aspjson.
@rcdmk The 3.5.1 update broke the following json parsing:
I will try to figure out why it is breaking. I reverted back to 3.5.0 and it is working
[[-117.215253710747,32.7973127662131],[-117.215039134026,32.7973623683555],[-117.21399307251,32.7971278852568],[-117.213585376739,32.7971639596199],[-117.212598323822,32.7973533497862],[-117.212115526199,32.7973804054914],[-117.212147712708,32.7970782829836]]
from aspjson.
Hum... This is strange...
I've tried a small test and it does work:
test = "[[-117.215253710747,32.7973127662131],[-117.215039134026,32.7973623683555],[-117.21399307251,32.7971278852568],[-117.213585376739,32.7971639596199],[-117.212598323822,32.7973533497862],[-117.212115526199,32.7973804054914],[-117.212147712708,32.7970782829836]]"
set json = new jsonObject
set arr = json.parse(test)
arr.write
Outputs:
[[-117.215253710747,32.7973127662131],[-117.215039134026,32.7973623683555],[-117.21399307251,32.7971278852568],[-117.213585376739,32.7971639596199],[-117.212598323822,32.7973533497862],[-117.212115526199,32.7973804054914],[-117.212147712708,32.7970782829836]]
Can you test this on your setup, please?
If you still have problems, please, post the smallest portion of code to reproduce the error.
from aspjson.
Related Issues (20)
- LoadRecordSet timing out within ArrayPush > Ubound Array HOT 8
- vbBack not a valid ASP/VBScript constant HOT 4
- Can this be used in a normal vbscript HOT 1
- ASP Syntax error "class JSONobject" HOT 2
- Fails to parse object array (even your own example) HOT 4
- Loading JSON into Array - looping the Array HOT 6
- Error when nesting HOT 7
- Tinyint type with MySQL HOT 1
- class JSONarray 's version may be wrong? HOT 1
- handling post request from axios or vueresource HOT 6
- Handling Arrays When Using Key Value Pairs HOT 3
- add lcase as an option when LoadRecordset HOT 3
- Problem when adding Parse, Add and Loadrecordsets HOT 3
- Usage File/Manual HOT 2
- JSON works on React? HOT 2
- Can't access array after parse HOT 4
- Loop through objects to get the property name HOT 2
- Encoding Issue - loop's. HOT 3
- Hoy to read array and nested objects HOT 1
- Extended quote characters are converted to other characters HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspjson.