dojo/io-query (version 1.10)

Summary

This module defines query string processing functions.

See the dojo/io-query reference documentation for more information.

Method Summary

  • objectToQuery(map) takes a name/value mapping object and returns a string representing a URL-encoded version of that object.
  • queryToObject(str) Create an object representing a de-serialized query section of a URL.

Methods

objectToQuery(map)
Defined by dojo/io-query

takes a name/value mapping object and returns a string representing a URL-encoded version of that object.

Parameter Type Description
map Object
Returns:undefined

Examples

Example 1

this object:

{
    blah: "blah",
    multi: [
        "thud",
        "thonk"
    ]
};

yields the following query string:

"blah=blah&multi=thud&multi=thonk"
queryToObject(str)
Defined by dojo/io-query

Create an object representing a de-serialized query section of a URL. Query keys with multiple values are returned in an array.

Parameter Type Description
str String
Returns:object

Examples

Example 1

This string:

"foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"

results in this object structure:

{
    foo: [ "bar", "baz" ],
    thinger: " spaces =blah",
    zonk: "blarg"
}

Note that spaces and other urlencoded entities are correctly handled.

Error in the documentation? Can’t find what you are looking for? Let us know!