我有以下json文件.我想知道在哪里将json文件放在我的项目中以及如何阅读和存储它.
{
"aakash": [
[ 0.070020,0.400684],
[ 0.134198,0.515837],
[ 0.393489,0.731809],
[ 0.281616,0.739490]
],
"anuj": [
[ 1287.836667,-22.104523],
[ -22.104523,308.689613],
[ 775.712801,-13.047385],
[ -13.047385,200.067743]
]
}
Run Code Online (Sandbox Code Playgroud) 我将使用包含一些数据的本地JSON文件.我的问题是存储文件的最佳/正确方法在哪里,我应该如何访问它及其内容?
我曾经通过http与json合作,但不是本地的.
我正在创建一个应用程序,在我的应用程序中,我收到响应并将其显示在自定义警报对话框中,直到这里它工作正常,现在我想做的是,如果用户从警报对话框中选择一个项目一次,它应该将其存储在偏好,这样就不需要每次都获取数据。
以下是我的代码片段。
我得到的以下回复是:
{
"states": [
{
"id": "1",
"state_slug": "agra",
"statename": "Agra"
},
{
"id": "2",
"state_slug": "andaman_and_nicobar_islands",
"statename": "Andaman and Nicobar Islands"
},
{
"id": "3",
"state_slug": "andhra_pradesh",
"statename": "Andhra Pradesh"
},
{
"id": "4",
"state_slug": "arunachal_pradesh",
"statename": "Arunachal Pradesh"
},
{
"id": "5",
"state_slug": "assam",
"statename": "Assam"
},
{
"id": "6",
"state_slug": "bihar",
"statename": "Bihar"
},
{
"id": "7",
"state_slug": "bulandshahr",
"statename": "Bulandshahr"
},
{
"id": "8",
"state_slug": "chhattisgarh",
"statename": "Chhattisgarh"
},
{
"id": "9",
"state_slug": "dadra_and_nagar_haveli", …Run Code Online (Sandbox Code Playgroud) 我有json文件我需要关于它的类文件
{
"CountryDetail":[
{
"C_country":"India",
"C_sunrise":1381107633,
"C_sunset":1381149604
},
"weatherDetail":
{
"w_id":711,
"w_main":"Smoke",
"w_description":"smoke",
}
,
"Tempdetail":
{
"t_temp":304.15,
"t_pressure":1009,
}
}
Run Code Online (Sandbox Code Playgroud)