我正在使用本地JSON文件从国家/地区代码中获取国家/地区名称。
我不想将整个文件读取为字符串,只是与给定的国家/地区代码匹配的部分。
这是JSON文件模式:
{
"name": {
"common": "Austria",
"official": "Republic of Austria",
"native": {
"bar": {
"official": "Republik Österreich",
"common": "Österreich"
}
}
},
"tld": [".at"],
"cca2": "AT",
"ccn3": "040",
"cca3": "AUT",
"cioc": "AUT",
"currency": ["EUR"],
"callingCode": ["43"],
"capital": "Vienna",
"altSpellings": ["AT", "Osterreich", "Oesterreich"],
"region": "Europe",
"subregion": "Western Europe",
"languages": {
"bar": "Austro-Bavarian German"
},
"translations": {
"cym": {"official": "Republic of Austria", "common": "Awstria"},
"deu": {"official": "Republik Österreich", "common": "Österreich"},
"fra": {"official": "République d'Autriche", "common": "Autriche"},
"hrv": {"official": "Republika Austrija", "common": "Austrija"},
"ita": {"official": "Repubblica d'Austria", "common": "Austria"},
"jpn": {"official": "オーストリア共和国", "common": "オーストリア"},
"nld": {"official": "Republiek Oostenrijk", "common": "Oostenrijk"},
"por": {"official": "República da Áustria", "common": "Áustria"},
"rus": {"official": "Австрийская Республика", "common": "Австрия"},
"spa": {"official": "República de Austria", "common": "Austria"}
},
"latlng": [47.33333333, 13.33333333],
"demonym": "Austrian",
"landlocked": true,
"borders": ["CZE", "DEU", "HUN", "ITA", "LIE", "SVK", "SVN", "CHE"],
"area": 83871
}
有关如何仅将该重要位读取到字符串的任何建议吗?