Skip to content

Miva Array Deserialize

Converts a miva_array_serialize string to a JavaScript object.

View in BitBucket

Parameters

String - input

the input to be parsed as a serialized string

Return Value

A parsed object or value, null if unable to parse

Example Usage

import mivaArrayDeserialize from '@mvps-genesis/miva-array-deserialize';

const myObject = mivaArrayDeserialize( ':products[1]:code=123,:products[2]:code=456' );

console.log( myObject );

/*
output:

{
    products: [
        {
            code: 123
        },
        {
            code: 456
        }
    ]
}
*/