You'll need this online json editor https://jsoneditoronline.org (remove anything on left side if there is any code).
- open alignment.json in notepad(keep it opened)
- copy everything from there(ctrl+a, then ctrl+c)
- paste it in left area in online json editor (ctrl+v)
- copy this code
const prefixes = ['Anub', 'Leito', 'Nibbles', 'Billyy', /* add any other prefixes for animations you want to clean from alignment.json */]
function query (data) {
return filterKeys(data, key => {
return !prefixes.find(pref => key.includes(pref))
})
}
function filterKeys(obj, predicate) {
// The function to filter keys based on the predicate
if (Array.isArray(obj)) {
// If it's an array, filter each element
return obj.map(item => filterKeys(item, predicate));
} else if (typeof obj === 'object' && obj !== null) {
// If it's an object, filter its keys
const result = {};
Object.keys(obj).forEach(key => {
if (predicate(key)) {
// If the key matches the predicate, add it to the result
result[key] = filterKeys(obj[key], predicate);
}
});
return result;
}
// Return the value if it's not an object or array
return obj;
} - click Transform Content(click on image to enlarge)
- paste copied code here(click on image to enlarge)
- hit Transform button
- click anywhere on the left pan(where is json content) and select everything(ctrl+a) copy it(ctrl+c)
- switch to opened in notepad alignment.json
- select everything(ctrl+a) and paste whatever you copied from online json editor(ctrl+c)
- save it and close.
1 comment