parse

Function

把 query string 解析成对象(支持还原嵌套对象/数组结构,和 `stringify` 互为逆操作)

Signature

function parse(str: string, options?: (IParseOptions<BooleanOptional> & { decoder?: never | undefined; }) | undefined): ParsedQs

Parameters

NameTypeDescription
strstring
optionsoptional(IParseOptions<BooleanOptional> & { decoder?: never | undefined; }) | undefined

Returns

ParsedQs

Examples

parse('a=1&b[0]=x&b[1]=y') // { a: '1', b: ['x', 'y'] }

Source

node_modules/.pnpm/@types+qs@6.15.1/node_modules/@types/qs/index.d.ts:78