简体   繁体   English

遍历 QuranGlobal JSON 响应

[英]Iterating over QuranGlobal JSON response

I have a difficulty iterating over the JSON response from QuranGlobal.com the response is coming too nested with a lot of objects and documentations are very complicated specially it's my first app so I am not that much expert我在迭代 QuranGlobal.com 的 JSON 响应时遇到困难

I did try a lot of things and nothing helps while other apis is not matching what in my mind one more question: after iterating how to dsiplay on the screen to be like pages not lists shall I use FaltList or something else我确实尝试了很多东西,但没有任何帮助,而其他 api 与我脑海中的另一个问题不匹配:在迭代如何在屏幕上播放 dsiplay 以使其类似于页面而不是列表之后,我应该使用 FaltList 还是其他东西

if anybody can give me help如果有人可以帮我

Thank you in advance先感谢您

{
    "quran": {
        "quran-simple": {
            "6222": {
                "id": 6222,
                "surah": 112,
                "ayah": 1,
                "verse": " قُلْ هُوَ اللَّهُ أَحَدٌ"
            },
            "6223": {
                "id": 6223,
                "surah": 112,
                "ayah": 2,
                "verse": "اللَّهُ الصَّمَدُ"
            },
            "6224": {
                "id": 6224,
                "surah": 112,
                "ayah": 3,
                "verse": "لَمْ يَلِدْ وَلَمْ يُولَدْ"
            },
            "6225": {
                "id": 6225,
                "surah": 112,
                "ayah": 4,
                "verse": "وَلَمْ يَكُنْ لَهُ كُفُوًا أَحَدٌ"
            },
            "6226": {
                "id": 6226,
                "surah": 113,
                "ayah": 1,
                "verse": " قُلْ أَعُوذُ بِرَبِّ الْفَلَقِ"
            },
            "6227": {
                "id": 6227,
                "surah": 113,
                "ayah": 2,
                "verse": "مِنْ شَرِّ مَا خَلَقَ"
            },
            "6228": {
                "id": 6228,
                "surah": 113,
                "ayah": 3,
                "verse": "وَمِنْ شَرِّ غَاسِقٍ إِذَا وَقَبَ"
            },
            "6229": {
                "id": 6229,
                "surah": 113,
                "ayah": 4,
                "verse": "وَمِنْ شَرِّ النَّفَّاثَاتِ فِي الْعُقَدِ"
            },
            "6230": {
                "id": 6230,
                "surah": 113,
                "ayah": 5,
                "verse": "وَمِنْ شَرِّ حَاسِدٍ إِذَا حَسَدَ"
            },
            "6231": {
                "id": 6231,
                "surah": 114,
                "ayah": 1,
                "verse": " قُلْ أَعُوذُ بِرَبِّ النَّاسِ"
            },
            "6232": {
                "id": 6232,
                "surah": 114,
                "ayah": 2,
                "verse": "مَلِكِ النَّاسِ"
            },
            "6233": {
                "id": 6233,
                "surah": 114,
                "ayah": 3,
                "verse": "إِلَٰهِ النَّاسِ"
            },
            "6234": {
                "id": 6234,
                "surah": 114,
                "ayah": 4,
                "verse": "مِنْ شَرِّ الْوَسْوَاسِ الْخَنَّاسِ"
            },
            "6235": {
                "id": 6235,
                "surah": 114,
                "ayah": 5,
                "verse": "الَّذِي يُوَسْوِسُ فِي صُدُورِ النَّاسِ"
            },
            "6236": {
                "id": 6236,
                "surah": 114,
                "ayah": 6,
                "verse": "مِنَ الْجِنَّةِ وَالنَّاسِ"
            }
        }
    }
}

Try this:尝试这个:

const firstAyah = 6222, lastAyah = 6236
const resp = `your json response`
for(let i = firstAyah, i <= lastAyah; i++)
    console.log(`Surah: ${resp.quran['quran-simple'][i].surah} Ayah number: ${resp.quran.['quran-simple'][i].ayah}, Ayah: ${resp.quran.['quran-simple'][i].verse}`)

If you encounter any problem, please let me know如果您遇到任何问题,请告诉我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM