Jeffail/gabs

Append second json object at a specific location in first json object

Closed this issue · 1 comments

Greetings,
I have two json objects.
First one.

{
  "hosts": {
    "58.226.2.241:5064": {
      "host": [
        "58.226.2.241:5064"
      ],
      "position": "1"
    }
  }
}

Second

{
  "127.0.0.1:5064": {
    "host": [
      "127.0.0.1:5064"
    ]
  },
  "position": "2"
}

I would like to append second to first after the "hosts" key so the result should look like below.

{
  "hosts": {
    "58.226.2.241:5064": {
      "host": [
        "58.226.2.241:5064"
      ],
      "position": "1"
    },
    "127.0.0.1:5060": {
      "host": [
        "127.0.0.1:5060"
      ],
      "position": "2"
    }
  }
}

But i am miserably failing here. https://play.golang.org/p/daB-y98d2F-

Thanks.

I was able to find the way. Thanks for awesome work.