Opened 2 years ago

Closed 2 years ago

#128 closed defect (fixed)

Survex JSON export Format

Reported by: Pawczak Owned by: Olly Betts
Priority: minor Milestone: 1.4.2
Component: Other Version: 1.4.1
Keywords: JSON Export Cc:

Description

Hey!

I'm use a lot of Export function to get cave surveys positions and found out that JSON format exported by Survex isn't correct.

This is file exported as JSON from Survex:

var p = [0.00,0.00,0.00,10.00,10.00,10.00]
var groups = [
[[0.00,0.00,0.00],[0.00,0.00,10.00]],
[[0.00,0.00,0.00],[0.00,10.00,0.00]],
[[0.00,0.00,10.00],[10.00,0.00,10.00]],
[[10.00,0.00,10.00],[10.00,0.00,0.00]],
[[10.00,0.00,0.00],[0.00,0.00,0.00]],
[[10.00,10.00,0.00],[0.00,10.00,0.00]],
[[10.00,10.00,0.00],[10.00,0.00,0.00]],
[[10.00,10.00,10.00],[10.00,10.00,0.00]],
[[10.00,10.00,10.00],[10.00,0.00,10.00]],
[[0.00,10.00,10.00],[10.00,10.00,10.00]],
[[0.00,10.00,10.00],[0.00,0.00,10.00]],
[[0.00,10.00,0.00],[0.00,10.00,10.00]]
]}

You can use simple site checking format validation: https://jsonformatter.curiousconcept.com/#

Trying to parse that file as JSON without additional pre-processing will always fail.

Change History (2)

comment:1 Changed 2 years ago by Pawczak

Version: 1.4.1

comment:2 Changed 2 years ago by Olly Betts

Milestone: 1.4.2
Resolution: fixed
Status: newclosed

Thanks, I've fixed the output to be valid JSON in 4fcdd51a6cc954d3ad2e3bd3044c91580d312df0.

I think the history of this is that it was from a quick hack where I wanted survey data for use in Javascript and the output was actually pulled in as Javscript source rather than read as JSON. It seemed others might find it useful so I added it as a standard feature but didn't think through that it's not really producing JSON.

Note: See TracTickets for help on using tickets.