Skip to content
Get on GitHub Autodesk App Store - coming soon

Data

5 nodes. Types ending in [] are lists. An input with a default is optional.

Nodes

JSON.Parse

Parses a JSON string into dictionaries, lists and values.

Inputs

Input Type Default What it does
json required string — The JSON text to parse.

Outputs

Output Type What it gives
value any The parsed value (dictionary, list, number, string, boolean or null).

Tags: json deserialize decode

JSON.Stringify

Serializes any value to a JSON string.

Inputs

Input Type Default What it does
value required any — The value to serialize.
indented boolean true True (default) for pretty-printed output.

Outputs

Output Type What it gives
json string The JSON text.

Tags: json serialize encode tostring

Snapshot.Diff

Diffs two GUID-keyed dictionaries: added/removed/changed keys (values compared by JSON equality; nested dictionary key order is ignored).

Inputs

Input Type Default What it does
oldValue required IDictionary — The older snapshot dictionary.
newValue required IDictionary — The newer snapshot dictionary.

Outputs

Output Type
addedKeys string[]
removedKeys string[]
changedKeys string[]

Returns: Dictionary with "addedKeys", "removedKeys" and "changedKeys".

Tags: compare delta difference version changes model compare

XML.Parse

Parses XML into dictionaries, lists and strings (attributes as "@name", repeated elements as lists, mixed text as "#text"). An element that occurs once is a dictionary or a text, the same element occurring twice is a list, so a graph tried on a file with several items can break on a file with one: name such elements in listElements (for example Task, Resource; or * for all) and they always come as a list. Dictionary.ValueAtPath reads nested results either way. DOCTYPE declarations are accepted but an external entity is never read from disk or the network.

Inputs

Input Type Default What it does
xml required string — The XML text to parse.
listElements string "" Names of elements that must always come as a list, even when the file holds only one of them; separated by commas or semicolons, or * for every element. Empty (default) keeps the rule that only repeated elements are lists.

Outputs

Output Type What it gives
value any The parsed value (dictionary of dictionaries/lists/strings).

Tags: xml parse deserialize decode markup schedule msp p6

XML.ReadFromFile

Reads an XML file into dictionaries, lists and strings, in the same shape as XML.Parse (attributes as "@name", repeated elements as lists, mixed text as "#text"). The encoding the file declares is honoured - UTF-8, UTF-16, Windows-1252 / ISO-8859-1 - so the accents of an MSP or P6 export survive; reading the file with Text.ReadFromFile and then XML.Parse would decode it as UTF-8 first. A relative path starts in the graph's folder.

Inputs

Input Type Default What it does
path required string — Path to the XML file. A relative path starts in the graph's folder.

Outputs

Output Type What it gives
value any The parsed value (dictionary of dictionaries/lists/strings), see XML.Parse.

Tags: xml read load import file parse markup schedule msp p6 encoding