Basic JSON question: Do I really need the quotes
moogyd at yahoo.co.uk
moogyd at yahoo.co.uk
Mon Oct 15 01:48:54 EDT 2012
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
More information about the Python-list
mailing list