create a dictionary with keys and values inside another key on user inputXcode successfully builds my target, but does not run the productHow do I sort a list of dictionaries by a value of the dictionary?Sort a Map<Key, Value> by valuesGetting key with maximum value in dictionary?How do I sort a dictionary by value?Add new keys to a dictionary?Check if a given key already exists in a dictionaryCreate a dictionary with list comprehension in PythonGet key by value in dictionaryHow can I sort a dictionary by key?How to remove a key from a Python dictionary?

Does WiFi affect the quality of images downloaded from the internet?

Does the UK delegate some immigration control to the Republic of Ireland?

David slept with Bathsheba because she was pure?? What does that mean?

Was the Lonely Mountain, where Smaug lived, a volcano?

Parsing text written the millitext font

What class is best to play when a level behind the rest of the party?

Is fission/fusion to iron the most efficient way to convert mass to energy?

I am caught when I was about to steal some candies

Harley Davidson clattering noise from engine, backfire and failure to start

Why is my Taiyaki (Cake that looks like a fish) too hard and dry?

Am I allowed to determine tenets of my contract as a warlock?

What is the theme of analysis?

What did the 8086 (and 8088) do upon encountering an illegal instruction?

In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?

Nth term of Van Eck Sequence

How to import .txt file with missing data?

Are athlete's college degrees discounted by employers and graduate school admissions?

LWC: detect last element in for:each iteration

When editor does not respond to the request for withdrawal

When a class dynamically allocates itself at constructor, why does stack overflow happen instead of std::bad_alloc?

Is Jesus the last Prophet?

Why would a car salesman tell me not to get my credit pulled again?

Why would a home insurer offer a discount based on credit score?

How do I type a hyphen in iOS 12?



create a dictionary with keys and values inside another key on user input


Xcode successfully builds my target, but does not run the productHow do I sort a list of dictionaries by a value of the dictionary?Sort a Map<Key, Value> by valuesGetting key with maximum value in dictionary?How do I sort a dictionary by value?Add new keys to a dictionary?Check if a given key already exists in a dictionaryCreate a dictionary with list comprehension in PythonGet key by value in dictionaryHow can I sort a dictionary by key?How to remove a key from a Python dictionary?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















So the idea is that users can create collections with many pairs of words in it.



For example, they created a collection nouns and added inside some words and the words' translations. And then they created another collection named colors and added corresponding keys and values and so on:



userInput = 
nouns:
"dog": "translation",
"cat": "translation",
"fish": "translation"
//etc
,
colors:
"red": "translation",
"green": "translation",
"blue": "translation"
//etc

//etc..



How do I implement this in Swift?



Does it mean that I have to create new dictionaries every time the user adds new collections?



I have tried doing something like



var dict = [String: AnyObject]()
var collectionNanme = input.text
dict[collectionNanme] = [Dictionary<String, String>]() as AnyObject

dict[collectionNanme].append([word1.text: word2.text])


But the number of erros in uncountable! What is the proper way to do this?



update:



import UIKit
var main = [String: [String:String]]()

class ViewController: UIViewController

@IBOutlet weak var collection: UITextField!
@IBOutlet weak var input1: UITextField!
@IBOutlet weak var input2: UITextField!

var collectionName = collection.text!
var inner:[String:String] = main[collectionName] ?? [:]

inner[input1.text!] = input2.text!
main[collectionName] = inner

@IBAction func click(_ sender: Any)
print(main[collectionName])











share|improve this question






























    0















    So the idea is that users can create collections with many pairs of words in it.



    For example, they created a collection nouns and added inside some words and the words' translations. And then they created another collection named colors and added corresponding keys and values and so on:



    userInput = 
    nouns:
    "dog": "translation",
    "cat": "translation",
    "fish": "translation"
    //etc
    ,
    colors:
    "red": "translation",
    "green": "translation",
    "blue": "translation"
    //etc

    //etc..



    How do I implement this in Swift?



    Does it mean that I have to create new dictionaries every time the user adds new collections?



    I have tried doing something like



    var dict = [String: AnyObject]()
    var collectionNanme = input.text
    dict[collectionNanme] = [Dictionary<String, String>]() as AnyObject

    dict[collectionNanme].append([word1.text: word2.text])


    But the number of erros in uncountable! What is the proper way to do this?



    update:



    import UIKit
    var main = [String: [String:String]]()

    class ViewController: UIViewController

    @IBOutlet weak var collection: UITextField!
    @IBOutlet weak var input1: UITextField!
    @IBOutlet weak var input2: UITextField!

    var collectionName = collection.text!
    var inner:[String:String] = main[collectionName] ?? [:]

    inner[input1.text!] = input2.text!
    main[collectionName] = inner

    @IBAction func click(_ sender: Any)
    print(main[collectionName])











    share|improve this question


























      0












      0








      0








      So the idea is that users can create collections with many pairs of words in it.



      For example, they created a collection nouns and added inside some words and the words' translations. And then they created another collection named colors and added corresponding keys and values and so on:



      userInput = 
      nouns:
      "dog": "translation",
      "cat": "translation",
      "fish": "translation"
      //etc
      ,
      colors:
      "red": "translation",
      "green": "translation",
      "blue": "translation"
      //etc

      //etc..



      How do I implement this in Swift?



      Does it mean that I have to create new dictionaries every time the user adds new collections?



      I have tried doing something like



      var dict = [String: AnyObject]()
      var collectionNanme = input.text
      dict[collectionNanme] = [Dictionary<String, String>]() as AnyObject

      dict[collectionNanme].append([word1.text: word2.text])


      But the number of erros in uncountable! What is the proper way to do this?



      update:



      import UIKit
      var main = [String: [String:String]]()

      class ViewController: UIViewController

      @IBOutlet weak var collection: UITextField!
      @IBOutlet weak var input1: UITextField!
      @IBOutlet weak var input2: UITextField!

      var collectionName = collection.text!
      var inner:[String:String] = main[collectionName] ?? [:]

      inner[input1.text!] = input2.text!
      main[collectionName] = inner

      @IBAction func click(_ sender: Any)
      print(main[collectionName])











      share|improve this question
















      So the idea is that users can create collections with many pairs of words in it.



      For example, they created a collection nouns and added inside some words and the words' translations. And then they created another collection named colors and added corresponding keys and values and so on:



      userInput = 
      nouns:
      "dog": "translation",
      "cat": "translation",
      "fish": "translation"
      //etc
      ,
      colors:
      "red": "translation",
      "green": "translation",
      "blue": "translation"
      //etc

      //etc..



      How do I implement this in Swift?



      Does it mean that I have to create new dictionaries every time the user adds new collections?



      I have tried doing something like



      var dict = [String: AnyObject]()
      var collectionNanme = input.text
      dict[collectionNanme] = [Dictionary<String, String>]() as AnyObject

      dict[collectionNanme].append([word1.text: word2.text])


      But the number of erros in uncountable! What is the proper way to do this?



      update:



      import UIKit
      var main = [String: [String:String]]()

      class ViewController: UIViewController

      @IBOutlet weak var collection: UITextField!
      @IBOutlet weak var input1: UITextField!
      @IBOutlet weak var input2: UITextField!

      var collectionName = collection.text!
      var inner:[String:String] = main[collectionName] ?? [:]

      inner[input1.text!] = input2.text!
      main[collectionName] = inner

      @IBAction func click(_ sender: Any)
      print(main[collectionName])








      swift xcode dictionary






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 0:50







      valeria

















      asked Mar 25 at 0:11









      valeriavaleria

      557




      557






















          1 Answer
          1






          active

          oldest

          votes


















          2














          You need



          var main = [String: [String:String]]()


          Get current value



          var collectionName = input.text! // nouns / colors
          var inner:[String:String] = main[collectionName] ?? [:]


          Change and set back



          inner["dog"] = "translation"
          main[collectionName] = inner



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()

          var collectionName = collection.text! // collection.text! will be "" as textfield is empty when the above function is called
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner



          @IBAction func click(_ sender: Any)
          print(main[collectionName])




          OR



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()





          @IBAction func save(_ sender: Any) // save button action
          print("Before save : " , main)

          var collectionName = collection.text!
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner

          print("After save : " , main)








          share|improve this answer

























          • wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

            – valeria
            Mar 25 at 0:51












          • and how can I make all of this global to access on other view controllers?

            – valeria
            Mar 25 at 0:56






          • 1





            see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

            – Sh_Khan
            Mar 25 at 1:00












          • great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

            – valeria
            Mar 25 at 1:28












          • does it work on your computer?

            – valeria
            Mar 25 at 9:51











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329805%2fcreate-a-dictionary-with-keys-and-values-inside-another-key-on-user-input%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You need



          var main = [String: [String:String]]()


          Get current value



          var collectionName = input.text! // nouns / colors
          var inner:[String:String] = main[collectionName] ?? [:]


          Change and set back



          inner["dog"] = "translation"
          main[collectionName] = inner



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()

          var collectionName = collection.text! // collection.text! will be "" as textfield is empty when the above function is called
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner



          @IBAction func click(_ sender: Any)
          print(main[collectionName])




          OR



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()





          @IBAction func save(_ sender: Any) // save button action
          print("Before save : " , main)

          var collectionName = collection.text!
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner

          print("After save : " , main)








          share|improve this answer

























          • wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

            – valeria
            Mar 25 at 0:51












          • and how can I make all of this global to access on other view controllers?

            – valeria
            Mar 25 at 0:56






          • 1





            see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

            – Sh_Khan
            Mar 25 at 1:00












          • great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

            – valeria
            Mar 25 at 1:28












          • does it work on your computer?

            – valeria
            Mar 25 at 9:51















          2














          You need



          var main = [String: [String:String]]()


          Get current value



          var collectionName = input.text! // nouns / colors
          var inner:[String:String] = main[collectionName] ?? [:]


          Change and set back



          inner["dog"] = "translation"
          main[collectionName] = inner



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()

          var collectionName = collection.text! // collection.text! will be "" as textfield is empty when the above function is called
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner



          @IBAction func click(_ sender: Any)
          print(main[collectionName])




          OR



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()





          @IBAction func save(_ sender: Any) // save button action
          print("Before save : " , main)

          var collectionName = collection.text!
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner

          print("After save : " , main)








          share|improve this answer

























          • wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

            – valeria
            Mar 25 at 0:51












          • and how can I make all of this global to access on other view controllers?

            – valeria
            Mar 25 at 0:56






          • 1





            see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

            – Sh_Khan
            Mar 25 at 1:00












          • great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

            – valeria
            Mar 25 at 1:28












          • does it work on your computer?

            – valeria
            Mar 25 at 9:51













          2












          2








          2







          You need



          var main = [String: [String:String]]()


          Get current value



          var collectionName = input.text! // nouns / colors
          var inner:[String:String] = main[collectionName] ?? [:]


          Change and set back



          inner["dog"] = "translation"
          main[collectionName] = inner



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()

          var collectionName = collection.text! // collection.text! will be "" as textfield is empty when the above function is called
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner



          @IBAction func click(_ sender: Any)
          print(main[collectionName])




          OR



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()





          @IBAction func save(_ sender: Any) // save button action
          print("Before save : " , main)

          var collectionName = collection.text!
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner

          print("After save : " , main)








          share|improve this answer















          You need



          var main = [String: [String:String]]()


          Get current value



          var collectionName = input.text! // nouns / colors
          var inner:[String:String] = main[collectionName] ?? [:]


          Change and set back



          inner["dog"] = "translation"
          main[collectionName] = inner



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()

          var collectionName = collection.text! // collection.text! will be "" as textfield is empty when the above function is called
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner



          @IBAction func click(_ sender: Any)
          print(main[collectionName])




          OR



          import UIKit

          var main = [String: [String:String]]() // global
          class ViewController: UIViewController

          @IBOutlet weak var collection: UITextField!
          @IBOutlet weak var input1: UITextField!
          @IBOutlet weak var input2: UITextField!


          var collectionName = "nouns"

          override func viewDidLoad()
          super.viewDidLoad()





          @IBAction func save(_ sender: Any) // save button action
          print("Before save : " , main)

          var collectionName = collection.text!
          var inner:[String:String] = main[collectionName] ?? [:]
          inner[input1.text!] = input2.text!
          main[collectionName] = inner

          print("After save : " , main)









          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 9:44

























          answered Mar 25 at 0:19









          Sh_KhanSh_Khan

          54k51635




          54k51635












          • wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

            – valeria
            Mar 25 at 0:51












          • and how can I make all of this global to access on other view controllers?

            – valeria
            Mar 25 at 0:56






          • 1





            see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

            – Sh_Khan
            Mar 25 at 1:00












          • great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

            – valeria
            Mar 25 at 1:28












          • does it work on your computer?

            – valeria
            Mar 25 at 9:51

















          • wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

            – valeria
            Mar 25 at 0:51












          • and how can I make all of this global to access on other view controllers?

            – valeria
            Mar 25 at 0:56






          • 1





            see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

            – Sh_Khan
            Mar 25 at 1:00












          • great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

            – valeria
            Mar 25 at 1:28












          • does it work on your computer?

            – valeria
            Mar 25 at 9:51
















          wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

          – valeria
          Mar 25 at 0:51






          wow yes! it actually works but.. I've been trying to put this code in my view controller but with no success so far. can you please check out the update and tell me what I'm doing wrong?

          – valeria
          Mar 25 at 0:51














          and how can I make all of this global to access on other view controllers?

          – valeria
          Mar 25 at 0:56





          and how can I make all of this global to access on other view controllers?

          – valeria
          Mar 25 at 0:56




          1




          1





          see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

          – Sh_Khan
          Mar 25 at 1:00






          see edit also you should assign default values for the textfields in IB , or make the code inside viewDidLoad to be in an action

          – Sh_Khan
          Mar 25 at 1:00














          great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

          – valeria
          Mar 25 at 1:28






          great!! this seems legit.. but did you try to actually run it? it takes forever launching the project and in fact, never even does. I am very confused. What do you think is the problem?

          – valeria
          Mar 25 at 1:28














          does it work on your computer?

          – valeria
          Mar 25 at 9:51





          does it work on your computer?

          – valeria
          Mar 25 at 9:51



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329805%2fcreate-a-dictionary-with-keys-and-values-inside-another-key-on-user-input%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

          Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?