I've this plantUml
@startuml
!$user = {
"name": "John Doe",
"email": "john@gmail.com",
"points": 100,
"language": "en",
"settings": {
"notifications": {
"email": true,
"push": true,
"sms": false
}
},
"role": "user",
"premiumId": "premiumId"
}
HomePage -> HomePage: show loader
HomePage -> UserEndPoint : GET /user and check the user permissions
HomePage <-- UserEndPoint : $user
HomePage -> UserFriendsEndPoint : GET /user/friends
HomePage -> UserMentorsEndPoint : GET /user/mentors
HomePage -> UserGoalsEndPoint : GET /user/goals
HomePage -> ContentEndPoint : GET /content
and down below is how it's displayed.
How can I format the user data like is in the editor?
I tried to
!$user = {
"name": "John Doe\n",
"email": "john@gmail.com\n",
"points": 100,
"language": "en",
"settings": {
"notifications": {
"email": true,
"push": true,
"sms": false
}
},
"role": "user",
"premiumId": "premiumId"
}
But with this, the diagram is displayed like down below
I tried
"name": "John Doe"\n
or
"name": "John Doe",\n
but both throw me an error.
How can I format like
{
"name": "John Doe",
"email": "john@gmail.com",
"points": 100,
"language": "en",
"settings": {
"notifications": {
"email": true,
"push": true,
"sms": false
}
},
"role": "user",
"premiumId": "premiumId"
}
right now I'm using plantuml for webstorm
The JSON format is probably most useful for diagramming JSON objects. You don't have to use it on a message (although I understand why you did). If all you want is a message for a sequence diagram, you can format it by hand:
@startuml
Bob -> Alice : {\n "name": "John Doe",\n "email": "john@gmail.com"\n}
@enduml
ETA: With many editors (webstorm?) you have the "join" function that will combine multiple lines into one. Then you only have to add the \n
's in the right places.