Render json models to png?

0 votes
asked Apr 1 in Question / help by Marcello

Hi

In my markdown files, I add this tags:

![](mainSequence.png)


<!--
@startuml mainSequence

User -> Browser: Submit
...

@enduml
-->
To define an render the image: mainSequence.png
From command line (kubuntu os) I run 
$plantuml -tpng <input-file-pattern>
And will generate the image mainSequence.png.
I have also included tags for json in the same file
![](RequestMessage.png)

<!--
@startjson RequestMessage
{
   "user": "mchiuminatto",
   "service":"tech-analysis",
   "instrument":"EUR/USD",
   "time-frame": "H1",
   "request-datetime": "2024-04-01 05:00:00" 
}
@endjson
-->
But plantuml will not generate the image.
Here goes the question.
Does exist any tool like command line plantuml to render PlantUML json as image?
Thanks!
commented Apr 3 by The-Lu (64,760 points)

Hi M.,

  • What is your plantuml version?
And with a short file input-file.puml  like:
@startjson RequestMessage
{
   "user": "mchiuminatto",
   "service":"tech-analysis",
   "instrument":"EUR/USD",
   "time-frame": "H1",
   "request-datetime": "2024-04-01 05:00:00" 
}
@endjson
$plantuml -tpng input-file.puml
  • What is the output or error?
Regards,
Th.

commented Apr 6 by anonymous

Hi Th

First of all thank you for your reply.

I've got the examples here:

https://github.com/mchiuminatto/plantuml_sandbox.git
 

Here's the plantuml output:

rm *.png
plantuml -tpng -v *
(0.000 - 248 Mo) 240 Mo - PlantUML Version 1.2020.02
(0.001 - 248 Mo) 240 Mo - GraphicsEnvironment.isHeadless() false
(0.001 - 248 Mo) 240 Mo - Forcing resource load on OpenJdk
(1.317 - 248 Mo) 234 Mo - Found 3 files
(1.317 - 248 Mo) 234 Mo - Working on $PWD/Makefile
(1.331 - 248 Mo) 233 Mo - Setting current dir: .
(1.331 - 248 Mo) 233 Mo - Setting current dir: $PWD
(1.332 - 248 Mo) 233 Mo - Using default charset
(1.335 - 248 Mo) 233 Mo - Reading from Makefile
(1.337 - 248 Mo) 233 Mo - Reading file: Makefile
(1.337 - 248 Mo) 233 Mo - Number of image(s): 0
Warning: no image in $PWD/Makefile
(1.337 - 248 Mo) 233 Mo - Working on $PWD/README.md
(1.338 - 248 Mo) 233 Mo - Setting current dir: $PWD
(1.338 - 248 Mo) 233 Mo - Using default charset
(1.338 - 248 Mo) 233 Mo - Reading from README.md
(1.356 - 248 Mo) 231 Mo - Reading file: README.md
(1.358 - 248 Mo) 231 Mo - name from block=mainSequence
(1.358 - 248 Mo) 231 Mo - Checking=mainSequence
(1.358 - 248 Mo) 231 Mo - f=mainSequence
(1.358 - 248 Mo) 231 Mo - Relative, so let's change it
(1.358 - 248 Mo) 231 Mo - f=$PWD/mainSequence
(1.358 - 248 Mo) 231 Mo - It's not a directory
(1.358 - 248 Mo) 231 Mo - mainSequence is not taken as a directory
(1.358 - 248 Mo) 231 Mo - We are going to put data in $PWD/mainSequence[0]
(1.411 - 248 Mo) 225 Mo - Compilation duration 52
(1.411 - 248 Mo) 225 Mo - Regex total/invoked/compiled 66/35/27
(1.411 - 248 Mo) 225 Mo - Matches created 74
(1.543 - 248 Mo) 223 Mo - Creating file: $PWD/mainSequence.png
(1.576 - 248 Mo) 212 Mo - Creating image 1138x496
(1.613 - 248 Mo) 207 Mo - Ok for com.sun.imageio.plugins.png.PNGMetadata
(1.684 - 248 Mo) 202 Mo - File size : 37274
(1.685 - 248 Mo) 202 Mo - Number of image(s): 1
(1.685 - 248 Mo) 202 Mo - Working on $PWD/json-model.puml
(1.685 - 248 Mo) 202 Mo - Setting current dir: $PWD
(1.685 - 248 Mo) 202 Mo - Using default charset
(1.685 - 248 Mo) 202 Mo - Reading from json-model.puml
(1.685 - 248 Mo) 202 Mo - Reading file: json-model.puml
(1.686 - 248 Mo) 202 Mo - Number of image(s): 0
Warning: no image in $PWD/json-model.puml

Regards

1 Answer

0 votes
answered Apr 8 by The-Lu (64,760 points)

Hello M.,

After analyse of your output:

plantuml -tpng -v *
(0.000 - 248 Mo) 240 Mo - PlantUML Version 1.2020.02

It is normal, because JSON management on PlantUML was only since 'V1.2020.21 (November 30, 2020)'.

  • Then could you update your 'plantuml.jar' with a new up to date version?

If that can help,

Regards,
Th.

...