Skip to main content

How to check the difference in JSON format

Shows how to display the major changes and their differences.

Introduction

  • If you save the project in JSON format, you can check the model change difference in text.
    • By specifying the project for which you want to check the difference, you can also display the difference on the editor as before.
    • Please refer to here for notes on saving in JSON format.
  • Here, we will show the basic JSON format notation and reading, and how to read the difference display in Git.

Model notation and reading in JSON format

The model and association are recorded. Each element is generally composed of the following elements.

Model JSON format notation example

//Example of use case "following driving (ADAPTIVE)"
{
"Id": "dfeab440-43ff-47d3-aec0-887e82b5e746",
"EntityType": "Entity",
"Name": "Following (ADAPTIVE)",
"MetamodelId": "122fabe8-c00b-422d-be66-59e86fd79d1b",
"Metamodel": "Use case",
"Fields": {
"Name": "Following (ADAPTIVE)",
"Description": "Driving while maintaining the distance from the preceding vehicle.",,
}
},
  • Id
    • Indicates the ID of the model. It can be used to search for the target with an error or to search for related references.
  • EntityType
    • Indicates the model type. The values are as follows.
      • Model-Entity
      • Interaction model elements-Lifeline etc.
  • Name
    • Indicates the name of the model.
  • MetamodelId
    • Indicates the model's metamodel ID.
  • Metamodel
    • Indicates the metamodel name of the model.
  • Fields
    • Shows the model field name and its value.
    • Only fields with values are recorded.
//Example of a relationship from the use case "ADAPTIVE" to any actor
{
"Id": "0299e2b0-2b44-47c0-b808-41ddcf643933",
"RelationType": "Ref",
"MetamodelId": "3a058d5b-880b-4d67-ab54-6e40f2c8a40d",
"Metamodel": "Main Actor Related",
"SourceId": "dfeab440-43ff-47d3-aec0-887e82b5e746",
"TargetId": "68f71941-4a9d-4ee0-afef-376c2b601f27"
},
  • Id
    • Indicates the associated ID.
  • RelationType
    • Indicates the related type. The values are as follows.
      • Embed --Ownership related
      • Ref-Reference related
  • MetamodelId
    • Indicates the ID of the associated metamodel.
  • Metamodel
    • Indicates the associated metamodel name.
  • SourceId
    • Indicates the ID of the associated model.
  • TargetId
    • Indicates the ID of the associated model.

Display diffs

The display method varies depending on the application that displays the difference, but basically it is highlighted in orange or red before the change, and in yellow or green after the change.

Change field value

edit

  • Displays the field name and value side by side for the value before and the value after the change.
    • The values before and after the change are highlighted, so you can see the difference at a glance.
  • Fields with unset values are not saved. If a value is set, it will appear as if a line of text has been added.
  • In case of replacement of related reference destination/reference source, the values of SourceId field and TargetId field are updated and highlighted.

Add element

add

  • The entire text of the newly added element is highlighted.

Delete element

delete

  • When deleting an element, the entire text is highlighted on the screen before the change and blank on the screen after the change.
  • It will be displayed in the same way when it is replaced with the parent element of another model file.

Reordering elements

reorder

  • If you have structured and saved, the elements that have been reordered will be highlighted (above).
    • At this time, the part of the same text that has no difference is not highlighted.
  • If not structured and saved, only the SourceIndex field will be updated and highlighted.
    • The SourceIndex field is a field that indicates the order of the elements (the index that indicates the number) in the field that can hold multiple elements. If it is not structured and saved, it will be saved in a file.
    • If you want to intuitively understand the order of the models instead of the SourceIndex field, set it to be structured and saved.
  • See here for structuring and saving.