--- /dev/null
+#include "ujdecode.c"
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <assert.h>
+
+// Gets the byte size of a file
+int file_byte_size(char* path)
+{
+ int f = open(path, O_RDONLY);
+ if(f == -1)
+ return -1;
+ struct stat s;
+ int ln = 0;
+ if(!fstat(f, &s))
+ ln = s.st_size;
+ close(f);
+ return ln;
+}
+
+int main(int argc, char** argv)
+{
+ if(argc == 1) {
+ printf("Usage: ./c_parser file\n");
+ exit(1);
+ }
+
+ int fl_sz = file_byte_size(argv[1]);
+ char* input = malloc(fl_sz);
+
+ FILE* ifl = fopen(argv[1], "r");
+ if(ifl == NULL) {
+ printf("Error: cannot read file %s, are you sure permissions are set correctly ?\n", argv[1]);
+ exit(2);
+ }
+ int rd = fread(input, 1, fl_sz, ifl);
+ assert(rd == fl_sz);
+
+ void *state;
+
+ UJObject obj = UJDecode(input, fl_sz, NULL, &state);
+
+ free(input);
+ UJFree(state);
+}
--- /dev/null
+require 'json/ext'
+
+txt = IO.read(ARGV.first)
+my_hash = JSON.parse(txt)
--- /dev/null
+package main
+
+import "io/ioutil"
+import "encoding/json"
+import "os"
+import "fmt"
+
+func main() {
+ if len(os.Args) == 1 {
+ fmt.Println("Usage ./json_parse file")
+ os.Exit(-1)
+ }
+ dat, err := ioutil.ReadFile(os.Args[1])
+ if err != nil { panic(err) }
+
+ var obj interface{}
+
+ jsonerr := json.Unmarshal(dat, &obj)
+ if jsonerr != nil { panic(jsonerr) }
+}
--- /dev/null
+require 'json/pure'
+
+txt = IO.read(ARGV.first)
+my_hash = JSON.parse(txt)
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json::string_parser
+
+var text = args.first.to_path.read_all_bytes.to_s
+var json = text.parse_json
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json::string_parser
+
+var f = new FileReader.open(args.first)
+
+var text = f.read_all
+f.close
+var json = text.parse_json
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json
+
+var text = args.first.to_path.read_all
+var json = text.parse_json
--- /dev/null
+import sys
+import json
+
+json_data=open(sys.argv[1]).read()
+data = json.loads(json_data)