I need to convert this Json Facebook Pages to array for select

user9186623

i need to change this code json to a select list because i try to work of fan page of facebook, but i dont kwno how construct a list with parse json and for o foreach and i want to know if you can help me

{
  "data": [
    {
      "access_token": "EASDASDASD",
      "category": "Producto/servicio",
      "category_list": [
        {
          "id": "2201231",
          "name": "Producto/servicio"
        },
        {
          "id": "50133821238",
          "name": "salsas"
        },
        {
          "id": "178669642112378193",
          "name": "Salsa"
        }
      ],
      "name": "Salsa Verde",
      "id": "283585512310",
      "tasks": [
        "ANALYZE",
        "ADVERTISE",
        "MODERATE",
        "CREATE_CONTENT",
        "MANAGE"
      ]
    },
    {
      "access_token": "KLAKSDKASDLASD",
      "category": "Escuela",
      "category_list": [
        {
          "id": "551123691940",
          "name": "Escuela"
        }
      ],
      "name": "Escuela de Altura",
      "id": "458438357842766",
      "tasks": [
        "ANALYZE",
        "ADVERTISE",
        "MODERATE",
        "CREATE_CONTENT",
        "MANAGE"
      ]
    }
  ],
  "paging": {
    "cursors": {
      "before": "WAsdaWq",
      "after": "ND4MzQWeqweQyNzY2"
    }
  }
}

to same like this, i need to print all pages with a list.

<ul class="list-group" id="data1">
<li class="list-group-item">name</li>
<li class="list-group-item">category</li>
<li class="list-group-item">aceess_token</li>
<li class="list-group-item">category_list: id</li>
<li class="list-group-item">category_list: name</li>
</ul>
<br><hr>
<ul class="list-group" id="data2">
<li class="list-group-item">name</li>
<li class="list-group-item">category</li>
<li class="list-group-item">aceess_token</li>
<li class="list-group-item">category_list: id</li>
<li class="list-group-item">category_list: name</li>
</ul>
<ul class="list-group" id="data3">
<li class="list-group-item">name</li>
<li class="list-group-item">category</li>
<li class="list-group-item">aceess_token</li>
<li class="list-group-item">category_list: id</li>
<li class="list-group-item">category_list: name</li>
</ul>

can you help me? i need to construct the list with the info

kmgt

var j = {
  "data": [
    {
      "access_token": "EASDASDASD",
      "category": "Producto/servicio",
      "category_list": [
        {
          "id": "2201231",
          "name": "Producto/servicio"
        },
        {
          "id": "50133821238",
          "name": "salsas"
        },
        {
          "id": "178669642112378193",
          "name": "Salsa"
        }
      ],
      "name": "Salsa Verde",
      "id": "283585512310",
      "tasks": [
        "ANALYZE",
        "ADVERTISE",
        "MODERATE",
        "CREATE_CONTENT",
        "MANAGE"
      ]
    },
    {
      "access_token": "KLAKSDKASDLASD",
      "category": "Escuela",
      "category_list": [
        {
          "id": "551123691940",
          "name": "Escuela"
        }
      ],
      "name": "Escuela de Altura",
      "id": "458438357842766",
      "tasks": [
        "ANALYZE",
        "ADVERTISE",
        "MODERATE",
        "CREATE_CONTENT",
        "MANAGE"
      ]
    }
  ],
  "paging": {
    "cursors": {
      "before": "WAsdaWq",
      "after": "ND4MzQWeqweQyNzY2"
    }
  }
};

var markup = '';

for (var x = 0; x < j.data.length; x++) {
  markup += '<ul class="list-group" id="data' + (x + 1) + '">';
  markup += '<li class="list-group-item">' +  j.data[x].name + '</li>';
  markup += '<li class="list-group-item">' +  j.data[x].category + '</li>';
  markup += '<li class="list-group-item">' +  j.data[x].access_token + '</li>';
  markup += '<li class="list-group-item">' +  j.data[x].category_list[0].id + '</li>';
  markup += '<li class="list-group-item">' +  j.data[x].category_list[0].name + '</li>';
  markup += '</ul>';
}

document.querySelector('#result').innerHTML = markup;
<div id="result"></div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

i need to convert Json to array and i'm need to read this array

i need to convert array value to json in jquery

I need to convert a javascript array to a sql list

I need to get a nested element in a json array

Facebook API 2.3's new publish_pages permission - do I need it?

Need a more efficient way to convert JDBC resultset to a JSON array

I need to convert a specially formatted string to an javascript array

Need to convert JSON to datatable

How can I convert an Array to Json (Java)

How do I convert JSON to Array

How do I convert a JSON array to an ArrayList?

How can I convert an array to JSON?

How do I add structured data using JSON-LD on dynamic pages that need to wait for content to load?

How can I convert JSON Array to array in PHP?

I want to convert my array into Json Array in Objective c

How can i convert json array in string format into array[]

How can I convert a json string to a json array using Newtonsoft?

How can I convert to Json Object to Json Array in Karate?

How do I convert an Array with a JSON string into a JSON object (ruby)

Jolt json transform question. Have a record with an array inside and need to convert to an array of records

Facebook feed pages where I am admin

I need to loop this array

Do I need to use posts or pages in WordPress?

need to convert object to JSON value

convert json to select data

Do I need to convert a value?

I have an xml response in a local .xml file which i need to convert to JSON in React

i need to get data from mysql DB and put it to a json array and use the json array for textbox auto complete

I'm writing json array to file. I'm getting [{ , , }][{ , , }][{ , , }]. I need this output [{ , , },{ , , },{ , , }]. Any Suggestions?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    pump.io port in URL

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  14. 14

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  15. 15

    How to use merge windows unallocated space into Ubuntu using GParted?

  16. 16

    flutter: dropdown item programmatically unselect problem

  17. 17

    Pandas - check if dataframe has negative value in any column

  18. 18

    Nuget add packages gives access denied errors

  19. 19

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  20. 20

    Generate random UUIDv4 with Elm

  21. 21

    Client secret not provided in request error with Keycloak

HotTag

Archive