Danbooru
Login Posts Comments Notes Artists Tags Pools Wiki Forum More ยป
Search Changes Help
  • |
  • Posts (0) History

    Blacklisted (help)

    • guro
    • scat
    • furry -rating:g
    Disable all Re-enable all

    Recent Changes (all)

    • evelyn hayworth
    • cynthia (moldavite)
    • vine trident
    • yung ming
    • stella arista
    • moldavite
    • ponzu
    • airi (quilt)
    • mizuki (quilt)
    • kyrie (quilt)
    • kanami (quilt)
    • ena (quilt)
    • hazawa tsugumi
    • sia (quilt)
    • takumi (quilt)
    • quilt (game)
    • icarly
    • drake & josh
    • frea nabbit (desktop army)
    • altrene
    • twisty amanozako
    • ko sooyoung
    • harley sarasa bastille
    • ati al-rashid
    • kishino mizuki

    Options

    • Wiki History
    • Discussions
    • What Links Here

    help:hash syntax

    URL search parameters after the "?" in a URL form the overall hash structure of the JSON object [1] sent to the server.

    Key/value

    Keys and values form a pair as a way to reference data. Each key/value pair in the search parameters is separated by an "&". The key is the text value to the left of the "=", and the "value" is the text value to the right of the "=" and may be "%" URL encoded [2].

    URL parameters
    limit=100&page=1
    JSON object
    {
        "limit": 100,
        "page": 1
    }

    Sub-hash

    Sub-hashes are supported by using square brackets "[ ]". The text value inside the square brackets is the sub key that the value will be added to.

    Single-level example
    URL parameters
    search[name]=test&search[order]=id&limit=20
    JSON object
    {
        "search": {
            "name": "test",
            "order": "id",
        },
        "limit": 20
    }
    Multi-level example

    Sub-hashes can form deeper sub-hashes by stacking the "[ ]" terms in a row.

    URL parameters
    search[user][id]=1
    JSON object
    {
        "search": {
            "user": {
                "id": 1
            }
        }
    }

    Array

    Arrays can be sent by appending an empty "[]" at the end of the final specifier for the key.

    Single-item example
    URL parameters
    search[name][]=test
    JSON object
    {
        "search": {
            "name": ["test"]
        }
    }
    Multi-item example

    Multiple array items are sent by using the exact same key for each value in the array.

    URL parameters
    search[id][]=1&search[id][]=2
    JSON object
    {
        "search": {
            "id": [1, 2]
        }
    }
    Array of files

    When sending an array of files, the parameter follows a similar format, although it is treated like a hash, where each key of the hash is the index of the file in the array, starting with 0. Since files require a multi-part format, it will look like something similar to the following.

    --9cab1cceecb6c4f5634bcba0e89ee77c
    Content-Disposition: form-data; name="upload[files][0]"; filename="6fe571c9df2912b1ae551045c2157240.jpg"
    Content-Type: image/jpeg
    
    <FILE DATA>

    See also

    • Help:Array syntax
    • Help:Chaining syntax
    • Help:API

    External links

    [1] https://www.w3resource.com/JSON/structures.php
    [2] https://www.w3schools.com/tags/ref_urlencode.ASP

    Terms / Privacy / Upgrade / Contact /