title: Parsing json response into dict using yaml
body: <p>I am trying to parse a string into a dictionary using python's yaml module. I am getting exception when the value has ":" in it. Here is my sample code</p>
  
  <pre><code>import yaml
  
  input = '''{"method":"Send", "buf":{"html":"&lt;html&gt;&lt;body&gt;&lt;div style=\"color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt\"&gt;&lt;ul&gt;&lt;li&gt;Sample message&lt;/li&gt;&lt;li&gt;Parse it&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;","text":"\t* Sample message\n\t* Parse it\n"}} '''
  yaml.load(input)
  </code></pre>
  
  <p>I get the following exception</p>
  
  <pre><code>Traceback (most recent call last):
    File "webmailparser.py", line 9, in ?
      yaml.load(input)
    File "/usr/lib/python2.4/site-packages/yaml/__init__.py", line 58, in load
      return loader.get_single_data()
    File "/usr/lib/python2.4/site-packages/yaml/constructor.py", line 42, in get_single_data
      node = self.get_single_node()
    File "/usr/lib/python2.4/site-packages/yaml/composer.py", line 35, in get_single_node
      if not self.check_event(StreamEndEvent):
    File "/usr/lib/python2.4/site-packages/yaml/parser.py", line 93, in check_event
      self.current_event = self.state()
    File "/usr/lib/python2.4/site-packages/yaml/parser.py", line 138, in parse_implicit_document_start
      StreamEndToken):
    File "/usr/lib/python2.4/site-packages/yaml/scanner.py", line 116, in check_token
      self.fetch_more_tokens()
    File "/usr/lib/python2.4/site-packages/yaml/scanner.py", line 252, in fetch_more_tokens
      return self.fetch_plain()
    File "/usr/lib/python2.4/site-packages/yaml/scanner.py", line 679, in fetch_plain
      self.tokens.append(self.scan_plain())
    File "/usr/lib/python2.4/site-packages/yaml/scanner.py", line 1308, in scan_plain
      "Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.")
  yaml.scanner.ScannerError: while scanning a plain scalar
    in "&lt;string&gt;", line 1, column 58:
       ... "html":"&lt;html&gt;&lt;body&gt;&lt;div style="color:#000; background-color:#ff ... 
                                           ^
  found unexpected ':'
    in "&lt;string&gt;", line 1, column 63:
       ... ":"&lt;html&gt;&lt;body&gt;&lt;div style="color:#000; background-color:#fff; fo ... 
                                           ^
  Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.
  </code></pre>
  
  <p>Is there any workaround for this?</p>
  
  <p>This worked</p>
  
  <pre><code>import yaml
  
  input = r'{"method":"Send", "buf":{"html":"&lt;html&gt;&lt;body&gt;&lt;div style=\"color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt\"&gt;&lt;ul&gt;&lt;li&gt;Sample message&lt;/li&gt;&lt;li&gt;Parse it&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;","text":"\t* Sample message\n\t* Parse it\n"}} '
  print yaml.load(input)
  </code></pre>