0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Intellijでjsonの比較を手軽に行う

Posted at

はじめに

テストを書いていて期待している結果と実際の結果が似通っていて、どこが違うのか簡単にわからない際に便利な方法をしったのでメモがてらまとめていきます

やり方

Intellijを使って2つのJSONを比較していきます

expected.json
{
    name: "test",
    answer: "1",
    msg: "hello"
}
actual.json
{
    name: "test",
    answer: "1"
}

この例は極端に簡単なので目に見て違いがわかりますが、複雑なjsonほど比較が難しいので役立ちます

まずはIntellijでshiftを2回押します
そして新規スクラッチバッファーを検索してクリックします

buffer.txtが開くのにここにexpected.jsonの内容をはります
次にactual.jsonをコピーしておきます

右クリックからクリップボードの比較を選ぶとどこが違うのかが表示されます

おわりに

Intellijの使い方も学んでいかないとなと最近感じました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?