VCOM:Working with JSON

From Vectorworks Developer
Revision as of 16:34, 16 November 2018 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

Enumerating Folder Contents

IJSONParserPtr jsonParser( IID_JSONParser );

TJSONMap	jsonData;
VCOMError err = jsonParser->Extract( json, jsonData );
if ( VCOM_SUCCEEDED( err ) )
{
	if ( jsonData.find("hasData") != jsonData.end() )
	{
		bool hasData = jsonData["hasData"]->Bool( false );
		hasData = hasData; // -> true
	}

	TJSONArray arrColors = jsonData["colors"]->Array();
	TXString colorName = arrColors[1]->Map()["color"]->String();
	colorName = colorName; // -> "white"
}
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox