Json Function
Search…
Json Function
Changelog
Functions
Schema
InnerJoin
Where
Select
Search
OrderBy
Limit
ToArray
Transform
Powered By
GitBook
ToArray
Converts objects into meaningful sequences.
Github
repository for your stars.
Usage
Install
$
npm
install
json-function
Import
import
{
toArray
}
from
'json-function'
;
Usage
Example Data
const
data
=
{
'SpahhfW88GEcnVEXBkSB'
:
{
name
:
'John'
},
'kDdjXxZWZwzKfYOyLUkE'
:
{
name
:
'Mike'
},
'yPND1ItYbQXgoBXIAsz8'
:
{
name
:
'Dan'
}
};
Default key
toArray
(
data
);
Output
[
{
uid
:
'SpahhfW88GEcnVEXBkSB'
,
name
:
'John'
},
{
uid
:
'kDdjXxZWZwzKfYOyLUkE'
,
name
:
'Mike'
},
{
uid
:
'yPND1ItYbQXgoBXIAsz8'
,
name
:
'Dan'
}
];
Use custom key
toArray
(
data
,
{
key
:
'_id_'
});
Output
[
{
_id_
:
'SpahhfW88GEcnVEXBkSB'
,
name
:
'John'
},
{
_id_
:
'kDdjXxZWZwzKfYOyLUkE'
,
name
:
'Mike'
},
{
_id_
:
'yPND1ItYbQXgoBXIAsz8'
,
name
:
'Dan'
}
];
Functions - Previous
Limit
Next - Functions
Transform
Last modified
3yr ago
Copy link
Outline
Usage