Last active
August 29, 2015 13:57
-
-
Save masakid/9602327 to your computer and use it in GitHub Desktop.
[Java]プロパティファイルに記述するJSON文字列
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# プロパティファイル(.properties)に記述するJSON | |
# | |
# 通常 | |
hoge=foo | |
# JSON | |
# ResourceBundle.getStringで以下のキーを指定するとJSON文字列が取れる | |
# JSON.decodeすればMap<String, String>で取得可能 | |
# *JSONの仕様上、keyは文字列じゃないとだめ。valueなら数値の指定が可能 | |
hoge={"1":"hoge","2","foo"} | |
# なお改行させて見やすくする事もできる | |
# こうすれば横に長いプロパティじゃなくてもいいから | |
# 保守性良くなる | |
hoge={"1":"hoge", ¥ | |
"2":"foo", ¥ | |
"3":"hogefoo", ¥ | |
"4":"foofoo" ¥ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment