# Best way to set a field value to be a (json) object?

**URL:** <https://discuss.elastic.co/t/best-way-to-set-a-field-value-to-be-a-json-object/165654>\
**Category:** Logstash\
**Created:** [January 24, 2019, 8:09pm UTC](https://discuss.elastic.co/t/best-way-to-set-a-field-value-to-be-a-json-object/165654 "2019-01-24T20:09:03Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jdmcalee](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@jdmcalee](https://discuss.elastic.co/u/jdmcalee)\
**Post date:** [January 25, 2019, 1:49pm UTC](https://discuss.elastic.co/t/best-way-to-set-a-field-value-to-be-a-json-object/165654/4 "2019-01-25T13:49:05Z")

</div>

By simplifying my config down, I must have ironically made things less clear. I was trying to avoid transforming anything at all; I'm adding a new field that I want to contain an object. In any event, this morning I finally searched for the right terms and came across a [post here](https://discuss.elastic.co/t/add-field-to-write-object-array-values/1095) that got me to an acceptable solution.

It's not quite what I started out toward, but it's good enough. I'm not sure arrays of nested objects are a good idea anyway, even if possible. For posterity, to end up with a field called links that is an object/hash of label =\> url (what the keys and values represent in this example), this works:

```
mutate {
    add_field => { "[links][google]" => "https://google.com" }
    add_field => { "[links][api]" => "/api" }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/best-way-to-set-a-field-value-to-be-a-json-object/165654)._
