JSON ファイルのように見えるファイルを解析する必要がありますが、そうではありません。文字が欠落:
しているため、を使用して解析できませんjson_decode
。私はこのファイルの所有者ではないので、そのままにしておく必要があります。このファイルを解析するにはどうすればよいですか? 何かご意見は?ありがとうございました
"sound_materials"
{
"common"
{
"value" "0"
"start_drag_sound" "ui.inv_pickup"
"end_drag_sound" "ui.inv_drop"
"equip_sound" "ui.inv_equip"
}
"chest"
{
"value" "1"
"start_drag_sound" "ui.inv_pickup_chest"
"end_drag_sound" "ui.inv_drop_chest"
}
"pennant"
{
"value" "2"
"start_drag_sound" "ui.inv_pickup_pennant"
"end_drag_sound" "ui.inv_drop_pennant"
}
"key"
{
"value" "3"
"start_drag_sound" "ui.inv_pickup_key"
"end_drag_sound" "ui.inv_drop_key"
}
"metal_small"
{
"value" "4"
"start_drag_sound" "ui.inv_pickup_metalsmall"
"end_drag_sound" "ui.inv_drop_metalsmall"
"equip_sound" "ui.inv_equip_metalsmall"
}
"metal_armor"
{
"value" "5"
"start_drag_sound" "ui.inv_pickup_metalarmour"
"end_drag_sound" "ui.inv_drop_metalarmour"
"equip_sound" "ui.inv_equip_metalarmour"
}
"metal_blade"
{
"value" "6"
"start_drag_sound" "ui.inv_pickup_metalblade"
"end_drag_sound" "ui.inv_drop_metalblade"
"equip_sound" "ui.inv_equip_metalblade"
}
"metal_heavy"
{
"value" "7"
"start_drag_sound" "ui.inv_pickup_metalheavy"
"end_drag_sound" "ui.inv_drop_metalheavy"
"equip_sound" "ui.inv_equip_metalheavy"
}
"staff_or_blunt"
{
"value" "8"
"start_drag_sound" "ui.inv_pickup_staff"
"end_drag_sound" "ui.inv_drop_staff"
"equip_sound" "ui.inv_equip_staff"
}
"robes"
{
"value" "9"
"start_drag_sound" "ui.inv_pickup_robes"
"end_drag_sound" "ui.inv_drop_robes"
"equip_sound" "ui.inv_equip_robes"
}
"leather"
{
"value" "10"
"start_drag_sound" "ui.inv_pickup_leather"
"end_drag_sound" "ui.inv_drop_leather"
"equip_sound" "ui.inv_equip_leather"
}
"quiver"
{
"value" "11"
"start_drag_sound" "ui.inv_pickup_quiver"
"end_drag_sound" "ui.inv_drop_quiver"
"equip_sound" "ui.inv_equip_quiver"
}
"stone"
{
"value" "12"
"start_drag_sound" "ui.inv_pickup_stone"
"end_drag_sound" "ui.inv_drop_stone"
"equip_sound" "ui.inv_equip_stone"
}
"wood"
{
"value" "13"
"start_drag_sound" "ui.inv_pickup_wood"
"end_drag_sound" "ui.inv_drop_wood"
"equip_sound" "ui.inv_equip_wood"
}
"bone"
{
"value" "14"
"start_drag_sound" "ui.inv_pickup_bone"
"end_drag_sound" "ui.inv_drop_bone"
"equip_sound" "ui.inv_equip_bone"
}
"jug"
{
"value" "15"
"start_drag_sound" "ui.inv_pickup_jug"
"end_drag_sound" "ui.inv_drop_jug"
"equip_sound" "ui.inv_equip_jug"
}
"gun"
{
"value" "16"
"start_drag_sound" "ui.inv_pickup_gun"
"end_drag_sound" "ui.inv_drop_gun"
"equip_sound" "ui.inv_equip_gun"
}
"highvalue"
{
"value" "17"
"start_drag_sound" "ui.inv_pickup_highvalue"
"end_drag_sound" "ui.inv_drop_highvalue"
"equip_sound" "ui.inv_equip_highvalue"
}
}
編集:
だから私はh2oが提案した正規表現を使用し、ファイルをフォーマットするのにうまく機能します。私の間違いは、上記の例では、1行のキーを持つ部分だけを配置したことです.
サブキーがあるファイルの他の部分がいくつかあります。この場合、サブキーの [ ] 区切り文字を追加する必要があります..: