Forum Discussion

eladfe's avatar
eladfe
Copper Contributor
Feb 19, 2023

Unpacking JSON

Hay , I am trying to unpack the JSON string  IPAddresses  from the table 

DeviceNetworkInfo: 
 DeviceNetworkInfo | take 10
 | project IP = parse_json(IPAddresses)
 | extend ADR = IP.IPAddress
 
I get an empty ADR column  .....
I tried to use this video to resolve the issue:
  • Here IP is still an array of IPAddress,SubnetPrefix,AddressType values so a simple reference to property IPAddress is not unique. You have to index to which element of IP you want, such as IP[0].IPAddress, IP[1].IPAddress, etc.
  • jbmartin6's avatar
    jbmartin6
    Iron Contributor
    Here IP is still an array of IPAddress,SubnetPrefix,AddressType values so a simple reference to property IPAddress is not unique. You have to index to which element of IP you want, such as IP[0].IPAddress, IP[1].IPAddress, etc.
    • eladfe's avatar
      eladfe
      Copper Contributor
      Great! Thank you !
      I have another question: Can I still get Other columns of DeviceNetworkInfo after unpacking the Json ?
      For example : Timestamp, Devicename, ADR (ADR isI P[0].IPAddress)
      • jbmartin6's avatar
        jbmartin6
        Iron Contributor
        Yes, all you are doing with parsing the JSON is adding columns, the original columns are all still ther

Resources