Parse all values on json fields (#678)

Summary:
I want to get a better visualisation of the databases values from a device, like the localStorage from ReactNative.

## Changelog

Iterate on the object value to parse all values from a json
Pull Request resolved: https://github.com/facebook/flipper/pull/678

Test Plan:
before:
<img width="1185" alt="Captura de Pantalla 2019-12-06 a la(s) 19 57 13" src="https://user-images.githubusercontent.com/25598400/70362212-e4a37280-1862-11ea-8b8b-a96edfece5c9.png">

after:
<img width="1185" alt="Captura de Pantalla 2019-12-06 a la(s) 19 55 52" src="https://user-images.githubusercontent.com/25598400/70362211-e4a37280-1862-11ea-8d16-00691c0f21c4.png">

Reviewed By: nikoant

Differential Revision: D18874887

Pulled By: passy

fbshipit-source-id: 679519fe2746a698e41ba015fd811a342c96c4fd
This commit is contained in:
Mateo Silguero
2019-12-10 06:02:40 -08:00
committed by Facebook Github Bot
parent f9c89c09ae
commit c4730c3e49

View File

@@ -1083,12 +1083,13 @@ export default class DatabasesPlugin extends FlipperPlugin<
buildSidebarRow = (key: string, val: any) => {
let output = '';
try {
output = (
<ManagedDataInspector
data={JSON.parse(val.props.children)}
expandRoot={true}
/>
);
const parsed = JSON.parse(val.props.children);
for (const key in parsed) {
try {
parsed[key] = JSON.parse(parsed[key]);
} catch (err) {}
}
output = <ManagedDataInspector data={parsed} expandRoot={true} />;
} catch (error) {
output = val;
}