Sunday, 7 April 2024

PlantUML: Highlight some parts of the json document

Using #highlight directive, we can highlight some parts of the json document.

Example

#highlight "name" : Highlight name property

#highlight "address" / "city" : Highlight city property in address json document

#highlight "hobbies" / "1" : Highlight second hobby, here indexing starts from 0.

#highlight "emails" / "0" / "id": Highlight id property of first email object

highlightJson.txt

@startjson

#highlight "name"
#highlight "address" / "city"
#highlight "hobbies" / "1"
#highlight "emails" / "0" / "id"

{
	"id" : 1,
	"name" : "Krishna",
	"address" : {
		"state" : "Karnatka",
		"city" : "Bnagalore",
		"country" : "India"
	},
	"hobbies" : [
		"Playing cricket",
		"blogging"
	],
	"emails" : [
		{
			"id" : "demo@demo1.com",
			"type" : "personal"
		},
		{
			"id" : "demo@demo2.com",
			"type" : "official"
		}
	]
}

@endjson

Above snippet generate below document.




 

  

Previous                                                 Next                                                 Home

No comments:

Post a Comment