Fill a datatable with JSON keys

Fill a datatable with JSON keys

fcarli98fcarli98 Posts: 2Questions: 1Answers: 0

Hi everyone, I've got a question: is it possible to fill a datatable where a column shows JSON keys of a JSON file ?

This question has an accepted answers - jump to answer

Answers

  • fcarli98fcarli98 Posts: 2Questions: 1Answers: 0
    edited February 26

    That's the JSON file I got:

    "rsp": {
        "74ad8ec6876e2e3366bfd566581ca7e8": {
          "app_name": "",
          "num_uses": 4
        },
        "0c0141e61036df715e310ac24a1ee456": {
          "app_name": "",
          "num_uses": 11
        },
        "44d502d471cfdb99c59bdfb0f220e5a8": {
          "app_name": "",
          "num_uses": 4
        },
        "f436b9416f37d134cadd04886327d3e8": {
          "app_name": "",
          "num_uses": 9
        },
        "398430069e0a8ecfbc8db0778d658d77": {
          "app_name": "",
          "num_uses": 1
        },
        "b32309a26951912be7dba376398abc3b": {
          "app_name": "",
          "num_uses": 19
        },
        "4d61c917a3225da2223d1955dc719e5d": {
          "app_name": "",
          "num_uses": 2
        },
        "7d52c9129b8b07502d1471697c2982dd": {
          "app_name": "",
          "num_uses": 7
        },
        "dda262729e5413660ec0e6a8d4279860": {
          "app_name": "",
          "num_uses": 1
        },
        "7f805430de1e7d98b1de033adb58cf46": {
          "app_name": "",
          "num_uses": 1
        },
        "080027e640f8ec6d966f79fc2f7ca551": {
          "app_name": "",
          "num_uses": 29
        }
      },
      "rc_str": "OK",
      "rc": 0,
      "rc_str_hr": "Success"
    }
    

    I'd like to take alphanumeric codes and "num_uses" to fill my datatable.

  • sandysandy Posts: 705Questions: 0Answers: 194
    Answer ✓

    Hi @fcarli98,

    Yes that is possible, you need to set columns.data to be a function and return what you want in the column from that function. Take a look at this example, hopefully you can use that as a starting point.

    Thanks,
    Sandy

Sign In or Register to comment.