I want rearrange the key value pair in a javascript object based on the value.
var in = {
'b': 'asdsad',
'm': [{
'0': 'asdsad'
}, {
'1': 'masdas'
}, {
'4': 'dsfdsfsdf'
}],
'c': 'masdas',
'a': [{
'b': 'asdsad'
}, {
'c': 'masdas'
}, {
'k': 'dsfdsfsdf'
}],
'z': 'asdasdads'
}
I want to rearrange the object so that I will have the arrays as the last key value pairs.
Expected output
var out = {
'b': 'asdsad',
'c': 'masdas',
'z': 'asdasdads',
'm': [{
'0': 'asdsad'
}, {
'1': 'masdas'
}, {
'4': 'dsfdsfsdf'
}],
'a': [{
'b': 'asdsad'
}, {
'c': 'masdas'
}, {
'k': 'dsfdsfsdf'
}]
}