Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31284

Re: Basic JSON question: Do I really need the quotes

Newsgroups comp.lang.python
Date 2012-10-14 22:48 -0700
References <cbd2f125-38ca-4f46-9077-95de0cf7ea6f@googlegroups.com>
Message-ID <cd8fbd9e-9b0f-41ba-848c-ceaa4b7565d0@googlegroups.com> (permalink)
Subject Re: Basic JSON question: Do I really need the quotes
From moogyd@yahoo.co.uk

Show all headers | View raw


On Friday, 12 October 2012 16:09:14 UTC+2, (unknown)  wrote:
> Hi,
> 
> I need to define some configuration in a file that will be manually created.
> 
> Internally, the data will be stored as a dict, which contains various properties related to a design
> 
> e.g. Design Name, dependencies, lists of files (and associated libraries).
> 
> json seemed a quick an easy way of achieving this
> 
> Anyway, in simple terms my question - if I know everything is a string, how can I omit the quotation marks?
> 
> 
> 
> i.e. I can do
> 
> 
> 
> >>> json.loads('{"mykey":["data0", "data1"]}')
> 
> {u'mykey': [u'data0', u'data1']}
> 
> 
> 
> But I would like to do
> 
> >>> json.loads('{mykey:[data0, data1]}')
> 
> Traceback (most recent call last):
> 
> 
> 
> The problem is that I don't want to make users have to type redundant characters.
> 
> Is it possible?
> 
> Thanks,
> 
> Steven

Hi,
Thanks to everyone for the responses. I'll look at YAML and ConfigParser.
Steven

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Basic JSON question: Do I really need the quotes moogyd@yahoo.co.uk - 2012-10-12 07:09 -0700
  Re: Basic JSON question: Do I really need the quotes Kwpolska <kwpolska@gmail.com> - 2012-10-12 16:14 +0200
  Re: Basic JSON question: Do I really need the quotes Roel Schroeven <roel@roelschroeven.net> - 2012-10-12 19:27 +0200
  Re: Basic JSON question: Do I really need the quotes Adam Tauno Williams <awilliam@whitemice.org> - 2012-10-12 13:52 -0400
  Re: Basic JSON question: Do I really need the quotes Roy Smith <roy@panix.com> - 2012-10-12 20:03 -0400
    Re: Basic JSON question: Do I really need the quotes rusi <rustompmody@gmail.com> - 2012-10-12 20:30 -0700
  Re: Basic JSON question: Do I really need the quotes moogyd@yahoo.co.uk - 2012-10-14 22:48 -0700

csiph-web