Re: [go-nuts] Unmarshal Json

2017-09-26 Thread Shawn Milochik
Awesome! You're welcome.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Unmarshal Json

2017-09-26 Thread Richard Masci
Thank you very much I think that's going to work!

On Tue, Sep 26, 2017 at 5:22 PM, Richard Masci  wrote:

> Hi Shawn,
>
> Thanks for that... the JSON I gave stripped out a lot from the real JSON
> as I didn't want the company information to be out on the public internet.
>   The JSON is from querying a server via rest call, and the IP Addresses
> are other servers that have connected in to this one server to pull
> information from. So the JSON is not a static list but one that is subject
> to change where new IP connect in, and old disconnect.
>
> On Tue, Sep 26, 2017 at 3:55 PM, Shawn Milochik 
> wrote:
>
>> https://play.golang.org/p/5itvZlhOVr
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/golang-nuts/Pss2cEqaiYs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Unmarshal Json

2017-09-26 Thread Richard Masci
Hi Shawn,

Thanks for that... the JSON I gave stripped out a lot from the real JSON as
I didn't want the company information to be out on the public internet.
The JSON is from querying a server via rest call, and the IP Addresses are
other servers that have connected in to this one server to pull information
from. So the JSON is not a static list but one that is subject to change
where new IP connect in, and old disconnect.

On Tue, Sep 26, 2017 at 3:55 PM, Shawn Milochik 
wrote:

> https://play.golang.org/p/5itvZlhOVr
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/golang-nuts/Pss2cEqaiYs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Unmarshal Json

2017-09-26 Thread Shawn Milochik
https://play.golang.org/p/5itvZlhOVr

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


SV: [go-nuts] Unmarshal Json

2017-09-26 Thread Michael Banzon
Can it be parsed to a map[string]json.RawMessage (or a more specific type, if 
the value is a known type)?

-- 
Michael Banzon
https://michaelbanzon.com/

Fra: Rich
Sendt: 26. september 2017 20:23
Til: golang-nuts
Emne: [go-nuts] Unmarshal Json

I have a json I have to parse, and in that json one of the keys changes 
depending on the data being generated.  For example:

{
  "Servers": {
    "IPAddress=10.1.1.123": {
      "name": "DNS Server1",
      "type": "Apache Webserver"
    },
    "IPAddress=10.1.1.124": {
      "name": "DNS Server",
      "type": "Bind DNS"
    },
    "IPAddress=10.2.3.43": {
      "name": "Tomcat Server",
      "type": "Java App Server"
    }
  }
}

I have no idea what IPAddress is going to equal, so I'm having a hard time 
writing a struct for it.  Any idea how I can parse this JSON?

Thanks!
-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Unmarshal Json

2017-09-26 Thread Rich
I have a json I have to parse, and in that json one of the keys changes 
depending on the data being generated.  For example:

{
  "Servers": {
"IPAddress=10.1.1.123": {
  "name": "DNS Server1",
  "type": "Apache Webserver"
},
"IPAddress=10.1.1.124": {
  "name": "DNS Server",
  "type": "Bind DNS"
},
"IPAddress=10.2.3.43": {
  "name": "Tomcat Server",
  "type": "Java App Server"
}
  }
}

I have no idea what IPAddress is going to equal, so I'm having a hard time 
writing a struct for it.  Any idea how I can parse this JSON?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.