1

So I have a data structure like so...a dictionary...

         fbIds = ["him", "her", "it", "that"]

then I have a database i'm adding a json structure to...

         res =  r.table("usa_nyc_bronx_merchants").insert({

                "street_address": streetName.lower(),
                "city": cityName.lower(),
                "state": stateName.lower(),
                "zipcode": zipcodeNumber.lower(),
                "county": countyName.lower(),
                "fbIds": [ADD DICTIONARY ITEMS TO THIS ARRAY]
          .....

How do i add the items in that dictionary into that that json array...mind you all this code is already in a for loop.

Thanks!

1
  • fbIds is already an array, so this seems like it should be simple... if would help if you included the for loop in the example above as well so we could get a better idea of what you are trying to accomplish. Commented May 5, 2016 at 23:56

1 Answer 1

2

fbIds is already an array (list in python terms). So you should be able to just do:

res =  r.table("usa_nyc_bronx_merchants").insert({
            "street_address": streetName.lower(),
            "city": cityName.lower(),
            "state": stateName.lower(),
            "zipcode": zipcodeNumber.lower(),
            "county": countyName.lower(),
            "fbIds": fbIds
      .....
Sign up to request clarification or add additional context in comments.

3 Comments

Easy money. Trying to over think it for no reason.
Haha happens to the best of us :)
@sirvon please mark as answered if this helped you solve your problem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.