-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjson.js
76 lines (62 loc) · 3.13 KB
/
json.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
This file is part of TAPIS. TAPIS is a web page and a Javascript code
that builds queries and explore the STAplus content, saves it as CSV or
GeoJSON and connects with the MiraMon Map Browser. While the project is
completely independent from the Orange data mining software, it has been
inspired by its GUI. The general idea of the application is to be able
to work with STA data as tables.
The TAPIS client is free software under the terms of the MIT License
Copyright (c) 2023-2024 Joan Masó
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The TAPIS can be updated from https://github.com/joanma747/tapis.
Aquest codi JavaScript ha estat idea de Joan Masó Pau (joan maso at ieee org)
dins del grup del MiraMon. MiraMon és un projecte del
CREAF que elabora programari de Sistema d'Informació Geogràfica
i de Teledetecció per a la visualització, consulta, edició i anàlisi
de mapes ràsters i vectorials. Aquest progamari programari inclou
aplicacions d'escriptori i també servidors i clients per Internet.
No tots aquests productes són gratuïts o de codi obert.
En particular, el TAPIS es distribueix sota els termes de la llicència MIT.
El TAPIS es pot actualitzar des de https://github.com/joanma747/tapis.
*/
/*
This library use two main types of data. In general, table functions expect
these two objects as inputs and respond these as outputs.
dataTable is an array of records, each on being an object of key and value pairs.
Normaly, the same keys are present in every record, but this is
not required. values are not restricted being numbers, strings or
objects. See a json schema and examples in /schemas/data_*.json
*/
"use strict"
//json
function ParseJSON(json) {
var records;
if (typeof json.length === "undefined") {
var jsonArray = Object.keys(json);
if (jsonArray.length==1 && typeof json[jsonArray]==="object")
json=json[jsonArray];
}
if (typeof json.length !== "undefined")
records=json;
else if (typeof json.length !== "object") {
records=[];
records.push(json);
}
else
records=[];
return records;
}