diff --git a/README.md b/README.md new file mode 100644 index 0000000..392e8e7 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +## NOTES + +This is not perfect, but seems to work for a the tests I've run against it. diff --git a/json.db b/json.db index 745b5d8..e484fc9 100755 Binary files a/json.db and b/json.db differ diff --git a/jsonlib b/jsonlib new file mode 100755 index 0000000..8f0ee88 Binary files /dev/null and b/jsonlib differ diff --git a/jsonlib.pb b/jsonlib.pb index 6c5aeba..7fbf1c2 100755 --- a/jsonlib.pb +++ b/jsonlib.pb @@ -1,4 +1,5 @@ UseSQLiteDatabase() +OpenDatabase(0,"json.db","","",#PB_Database_SQLite) Procedure InsertIntoDatabase(key$, parentKey$, type$, value$) query$ = "INSERT INTO json_data (key, parent_key, type, value) VALUES ('" + key$ + "', '" + parentKey$ + "', '" + type$ + "', '" + value$ + "')" @@ -89,13 +90,15 @@ Procedure HandleNestedArray(JSONValue, parentKey$) Next EndProcedure + +Procedure parse(json) ; worry about the database init later -OpenDatabase(0,"json.db","","",#PB_Database_SQLite) + - LoadJSON(1,"test5.json");ParseJSON(1, json$) ; returns garbage without the PB ascii there not sure why - - ; ParseJSON(1, json$) ; returns garbage without the PB ascii there not sure why + ;LoadJSON(1,"test2.json") ; returns garbage without the PB ascii there not sure why + ParseJSON(1,json) + ObjectValue = JSONValue(1) If ExamineJSONMembers(ObjectValue) @@ -139,20 +142,16 @@ OpenDatabase(0,"json.db","","",#PB_Database_SQLite) EndSelect - ; Insert the parsed data into the SQLite database - ;query$ = "INSERT INTO json_data (key, parent_key, type, value) VALUES ('" + key$ + "', '" + parentKey$ + "', '" + type$ + "', '" + value$ + "')" - ;If DatabaseUpdate(0, query$) = 0 - ; Debug "Error inserting data: " + DatabaseError() - ;EndIf + InsertIntoDatabase(key$,parentKey$,type$,value$) Wend EndIf - -CloseDatabase(0) +EndProcedure ; IDE Options = PureBasic 6.12 LTS (Linux - x64) -; CursorPosition = 126 -; FirstLine = 89 +; CursorPosition = 149 +; FirstLine = 113 ; Folding = - ; EnableXP -; DPIAware \ No newline at end of file +; DPIAware +; Executable = jsonlib \ No newline at end of file