I'm not entirely clear on what you're after, but does this help? https://play.golang.org/p/AcNBcUVtXGg
That will return you the name field given a state name. If you need an integer congressional district number, that will require some modification. If you want this to work without having to provide a state name you could use a regular expression or string splitting functions to check if the key matches regardless of the state field. On Tue, Nov 20, 2018 at 10:27 PM Alex Dvoretskiy <advoretski...@gmail.com> wrote: > I need the other states, CA, IL... and the other districts 3, 5, 15...: > > "ocd-division/country:us/state:wi/cd:3" > "ocd-division/country:us/state:ca/cd:6" > "ocd-division/country:us/state:il/cd:7" > > I think it's not quite possible to unmarshal this... > perhaps use string functions to get congressional district number? I can > get the state from address. > > > On Tuesday, November 20, 2018 at 4:38:26 PM UTC-8, Alex Dvoretskiy wrote: >> >> Hello, >> >> I'm writing a tool for extracting congressional district. Getting http >> JSON response from google civic api. >> I need only one line *"name": "Wisconsin's 3rd congressional district" *How >> web developers usually proceed with such task? >> >> { >> "normalizedInput": { >> "line1": "9732 570th Avenue", >> "city": "Ellsworth", >> "state": "WI", >> "zip": "54011" >> }, >> "divisions": { >> "ocd-division/country:us": { >> "name": "United States", >> "officeIndices": [ >> 0, >> 1 >> ] >> }, >> "ocd-division/country:us/state:wi": { >> "name": "Wisconsin", >> "officeIndices": [ >> 2, >> 4, >> 5, >> 8, >> 9, >> 10, >> 11 >> ] >> }, >> "ocd-division/country:us/state:wi/cd:3": { >> "name": "Wisconsin's 3rd congressional district", >> "officeIndices": [ >> 3 >> ] >> }, >> "ocd-division/country:us/state:wi/county:pierce": { >> "name": "Pierce County", >> "officeIndices": [ >> 12, >> 13, >> 14, >> 15, >> 16, >> 17, >> 18 >> ] >> }, >> "ocd-division/country:us/state:wi/county:pierce/council_district:13": { >> "name": "Pierce County Supervisor District 13", >> "officeIndices": [ >> 19 >> ] >> }, >> "ocd-division/country:us/state:wi/county:pierce/place:oak_grove": { >> "name": "Oak Grove town" >> }, >> >> "ocd-division/country:us/state:wi/county:pierce/school_district:prescott_school_district": >> { >> "name": "prescott school district" >> }, >> "ocd-division/country:us/state:wi/court_of_appeals:3": { >> "name": "WI State Court of Appeals - District III (3)" >> }, >> "ocd-division/country:us/state:wi/sldl:93": { >> "name": "Wisconsin Assembly district 93", >> "officeIndices": [ >> 7 >> ] >> }, >> "ocd-division/country:us/state:wi/sldu:31": { >> "name": "Wisconsin State Senate district 31", >> "officeIndices": [ >> 6 >> ] >> } >> } >> } >> >> -- > 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. > -- mingle.cm | @caleb_io <http://twitter.com/caleb_io> -- 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.