0

I have this JSON for memes, but I dont know how to extract the styles JSON in card form, please, someboyd can help me?

This is my code DOM card to print the results

Api = 'https://api.imgflip.com/get_memes'

var container = document.getElementById("card");
for(var cardnum in data){

    var item = document.createElement("div");
    item.classList.add("item")
    item.classList.add("interact");

    var card = document.createElement("div");
    card.classList.add("card");
    var card_header = document.createElement("div");

    var id = document.createElement("h1");
    id.classList.add("h1");
    id.append(data[cardnum].name);
    card_header.appendChild(id);

    var card_header = document.createElement("div");
    card_header.classList.add("card-header");
    var header_text = document.createElement("span");
    header_text.classList.add("header");
    header_text.append(data[cardnum].name);
    card_header.appendChild(header_text);

    var card_body = document.createElement("div");
    card_body.classList.add("card-body");
    var img = document.createElement("img");
    var src_img = document.createAttribute("src");
    src_img.value = (data[cardnum].url);
    img.setAttributeNode(src_img);

    img.append(card_body);


    
    
    card.appendChild(card_header);
    card.appendChild(card_body);

    item.appendChild(card);

    container.appendChild(item);
}
Man
  • 1
  • 1
    See [Why is “Can someone help me?” not an actual question?](//meta.stackoverflow.com/q/284236/4642212). What _is_ your question? What does “extract styles” mean? – Sebastian Simon Jun 07 '21 at 12:16
  • If you saw the json, you have seeing the elements and "box_count" "width" "height" "color", my question is... how to put the JSON styles in html – Man Jun 07 '21 at 14:40
  • Please [edit] your post and include the missing details. Familiarize yourself with [how to access and process nested objects, arrays or JSON](/q/11922383/4642212) and use the available [`Object`](//developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#Static_methods) and [`Array`](//developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Static_methods) methods (both static and on prototype). – Sebastian Simon Jun 07 '21 at 14:43

0 Answers0