1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

lapras.comのプロフィール取得する(API)コード。

Posted at

lapras.comのプロフィール取得する(API)コードです。
作った経緯:下記のメールが来ていたので作ってみました。
LAPRAS で公開しているあなたのプロフィールをJSON形式で取得できるようになりました

function loop(data1){
    if(Array.isArray(data1)){
        data1.forEach((data2)=>{
            return loop(data2);
        });
    }else{
        if(typeof data1 === "object"){
            Object.keys(data1).forEach((data2)=>{
                if(Array.isArray(data1[data2])){
                   return loop(data1[data2]);
                }else{
                    console.log(data1[data2]);
                }
            });
        }else{
            console.log(data1);
        }
    }
}
fetch("https://lapras.com/public/GW0GSQI.json").then(response=>{
    return response.json();
}).then(data=>{
   loop(data); 
});

出力結果
SnapCrab_NoName_2022-12-14_22-1-45_No-00.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?