Is there a standard syntax for encoding structure objects as HTTP GET request parameters?
Posted
by lexicore
on Stack Overflow
See other posts from Stack Overflow
or by lexicore
Published on 2010-04-22T20:26:55Z
Indexed on
2010/04/22
20:43 UTC
Read the original article
Hit count: 277
Imagine we need to pass a a number structured objects to the web application - for instance, locale, layout settings and a definition of some query. This can be easily done with JSON or XML similar to the following fragment:
<Locale>en</Locale>
<Layout>
<Block id="header">hide</Block>
<Block id="footer">hide</Block>
<Block id="navigation">minimize</Block>
</Layout>
<Query>
<What>water</What>
<When>
<Start>2010-01-01</Start>
</When>
</Query>
However, passing such structures with HTTP implies (roughly speaking) HTTP POST.
Now assume we're limited to HTTP GET. Is there some kind of a standard solution for encoding structured data in HTTP GET request parameters?
I can easily imagine something like:
Locale=en&
Layout.Block.header=hide&
Layout.Block.footer=hide&
Layout.Block.navigation=minimize&
Query.What=water&
Query.When.Start=2010-01-01
But what I'm looking for is a "standard" syntax, if there's any.
ps. I'm surely aware of the problem with URL length. Please assume that it's not a problem in this case.
© Stack Overflow or respective owner