# Importing .json

**URL:** <https://community.graylog.org/t/importing-json/21250>\
**Category:** Graylog Central (peer support)\
**Created:** [September 20, 2021, 10:00pm UTC](https://community.graylog.org/t/importing-json/21250 "2021-09-20T22:00:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yazdesilva](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yazdesilva](https://community.graylog.org/u/yazdesilva)\
**Post date:** [September 20, 2021, 10:00pm UTC](https://community.graylog.org/t/importing-json/21250/1 "2021-09-20T22:00:14Z")

</div>

## Description of your problem

Hi All,  
I am trying to use “JSON path from HTTP API” or any other method to get API data that returns A JSON struct that has an array data similer to below:  
JSON data can be access via .json file or via the HTTP API

[ {  
“Role”: “Skype for Business Administrator”,  
“DisplayName”: “Jonathon”,  
“ObjectType”: “User”,  
“AccountEnabled”: true,  
“UserPrincipaName”: “”,  
“PasswordPolicies”: “None”,  
“HomePage”: null  
},  
{  
“Role”: “Skype for Business Administrator”,  
“DisplayName”: “Adam”,  
“ObjectType”: “User”,  
“AccountEnabled”: true,  
“UserPrincipaName”: “”,  
“PasswordPolicies”: “None”,  
“HomePage”: null  
}  
]

## Description of steps you’ve taken to attempt to solve the issue

I used the [https://jsonpath.com/](https://jsonpath.com/) to check on the JSONPath Syntax and it returns all nesesary data, but when using “JSON path from HTTP API”, i only get the first recoard.

Can someone please give me some ideas how to get .json file or .json API data into Graylog

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/5/56ed06fe14daa7f6783836faf2a7babf5d857640.png)

---

<div class="post-metadata">

**Author:** ![gsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gsmith/32/1222_2.png) [@gsmith](https://community.graylog.org/u/gsmith)\
**Post date:** [September 21, 2021, 12:01am UTC](https://community.graylog.org/t/importing-json/21250/2 "2021-09-21T00:01:57Z")

</div>

Hello && Welcome

> [@yazdesilva](#):
>
> Can someone please give me some ideas how to get .json file or .json API data into Graylog

I’m not sure what you environment is, but here is some information for you on the _JSON path from HTTP API input_ Perhaps these links will help.

**Graylog Input**

[https://docs.graylog.org/en/4.1/pages/sending/json.html](https://docs.graylog.org/en/4.1/pages/sending/json.html)

**Graylog API:**

[https://docs.graylog.org/en/4.1/pages/configuration/rest\_api.html](https://docs.graylog.org/en/4.1/pages/configuration/rest_api.html)

> **[HTTP JSON Web API Input](https://graylog.org/videos/http-json-web-api-input/)**
>
> Thinking Outside the Box For this example, I wanted to think outside of the box and show you an example how Graylog can be used to capture logs or data through anAPI and have it represented in a dashboard. JSON Web APIs have become a very popular...

**How To Send Log Data:**

[https://docs.graylog.org/en/4.1/pages/sending\_data.html#sending-in-log-data](https://docs.graylog.org/en/4.1/pages/sending_data.html#sending-in-log-data)

---

<div class="post-metadata">

**Author:** ![yazdesilva](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yazdesilva](https://community.graylog.org/u/yazdesilva)\
**Post date:** [September 21, 2021, 12:12am UTC](https://community.graylog.org/t/importing-json/21250/3 "2021-09-21T00:12:16Z")

</div>

Thanks for the reply.  
I have seen above, and noticed this artical. [Garylog and PRTG API (REST JSON)](https://community.graylog.org/t/garylog-and-prtg-api-rest-json/13335)

"Basically it’s a plain RESTFul API that can return A JSON struct that has an array with a dict entry for each item. So you can have something like:

{ … , “sensors”: [{“id”: “1234”, “name”: “sensor1”, … }, { "id: “1278”, “name”: “sensor2”}, …]}

What I want is to transform each item into a record in Graylog."

My API json output is array as above. Quetion is that can I use “JSON path from HTTP API input” to get each item into a record in Graylog?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![gsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gsmith/32/1222_2.png) [@gsmith](https://community.graylog.org/u/gsmith)\
**Post date:** [September 21, 2021, 12:41am UTC](https://community.graylog.org/t/importing-json/21250/4 "2021-09-21T00:41:49Z")

</div>

Hello,

> [@yazdesilva](#):
>
> uetion is that can I use “JSON path from HTTP API input” to get each item into a record in Graylog?

I believe you can by using _JSON path of data to extract_  
For example:

```auto
{
  "name": "Rose Kolodny",
  "phoneNumbers": [
    {
      "type": "home",
      "number": "954-555-1234"
    },
    {
      "type": "work",
      "number": "754-555-5678"
    }
  ]
}

```

JSON path of data to extract  
`$.phoneNumbers[*].number`

Which should return this

`[954-555-1234, 754-555-5678]`

---

<div class="post-metadata">

**Author:** ![yazdesilva](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yazdesilva](https://community.graylog.org/u/yazdesilva)\
**Post date:** [September 21, 2021, 12:52am UTC](https://community.graylog.org/t/importing-json/21250/5 "2021-09-21T00:52:29Z")

</div>

Thanks for your time gsmith, i will check it and let u know.

Cheers.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [October 5, 2021, 12:53am UTC](https://community.graylog.org/t/importing-json/21250/6 "2021-10-05T00:53:24Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
