-
Notifications
You must be signed in to change notification settings - Fork 2
Package Content
The package contains simple but powerful methods to create your custom json structure by providing its keys and values, or if you prefer import the content or an external file (either json, XML or CSV formats!) and use it right away on Dynamo.
The package is based on the use of two types objects JsonObject and JsonArray.
This is the core element of the package. Being a Dictionary
its underlying c# object type, JsonObjects provide several of a dictionary's methods with the extra value of displaying them using a json structure format.
![]() |
ByKeysAndValues: JsonObject constructor by a given key-value pair. It accepts nested structures by providing keys divided by points as a single string. |
![]() |
Add: Adds new attribute to the JsonObject. If given key already on the object and update set to True, value associated with the key will be updated. An error will be thrown otherwise. |
![]() |
FilterByKeyAndValue: Filters JsonObjects which contains the given key-value pair. If value is of type string, it will test if it contains the value given. |
![]() |
GetValueByKey: Returns the value associated with the given key from the jsonObject. |
![]() |
JsonOptions: Options for updating JsonObjects: None, Update and Combine. |
![]() |
Merge: Merge one JsonObject with one or multiple other JsonObjects. |
![]() |
Remove: Remove keys from the given JsonObject. If any key doesn't exit on the object or duplicated keys found on the input, error will be thrown. |
![]() |
SortByKeyValue: Sorts a list of JsonObjects by the ascending order of the values associated with the given key. |
![]() |
SortKeys: Sorts the JsonObject alphabetically by its keys. |
![]() |
Keys: Returns keys of attributes in the JsonObject. |
![]() |
Size: Returns the number of attributes on the JsonObject. |
![]() |
Size: Returns values of attributes in the JsonObject. |
JsonArray acts more as a helper object than a key one. Due to Dynamo's lacing properties, I soon found that the value of a JsonObject couldn´t be a list of items, so here is were JsonArray comes into play: it is a c# List
behaving as a single element, so JsonObjects can host them as a value.
![]() |
ByElements: JsonArray constructor by a given list of elements. |
![]() |
Elements: Returns elements in the JsonArray object. |
![]() |
Size: Returns the number of elements in the JsonArray object. |
The tools provided along with the package are currently focused on handling and parsing files from and to json format.
![]() |
CSVString: Parses a CSV formated string. It will return a list of JsonObjects. Error will be thrown if parser fails. |
![]() |
JsonString: Parses a json formated string. It will return JsonObject, JsonArray or other match that the parser can do from the input. Error will be thrown if parser fails. |
![]() |
JsonToCSV: Converts a list of JsonObject to CSV string format. JsonObjects must have one level only (no other JsonObject or JsonArray as values), being the keys the header of the CSV string. |
![]() |
JsonToXML: Converts a JsonObject to XML string format. Parses a CSV formated string. It will return a list of JsonObjects. Error will be thrown if parser fails. |
![]() |
XMLString: Parses a xml formated string. It will return JsonObject, JsonArray or other match that the parser can do from the input. Error will be thrown if parser fails. |
![]() |
FromCSVFile: Reads and parses a CSV formated file. It will return a list of JsonObjects. Error will be thrown if parser fails. |
![]() |
FromJsonFile: Reads and parses a json file. It will return JsonObject, JsonArray or other match that the parser can do from the input. Error will be thrown if parser fails. |
![]() |
FromXMLFile: Reads and parses a XML file. It will return JsonObject, JsonArray or other match that the parser can do from the input. Error will be thrown if parser fails. |
![]() |
ToCSVFile: Writes a list of JsonObject to a CSV file. JsonObjects must have one level only (no other JsonObject or JsonArray as values), being the keys the header of the CSV string. |
![]() |
ToJsonFile: Writes the JsonObject or JsonArray to a json file. |
![]() |
ToXMLFile: Writes the JsonObject or JsonArray to a XML file. |