Basically, you first need to detect the node’s type (for some node types, you can e.g. do this with const {Text} = require('scenegraph'); if (yourNode instanceof Text) { /* Do stuff here */ }
).
Then, you’ll need to create a new object containing all the properties this type owns according to the documentation:
return {
text: yourNode.text,
// [...]
textStyles: yourNode.textStyles
}
This – as you can see – is a very tedious (since manual) process (and I don’t think there is an alternative way right now). Therefore, it might be useful to know the use case you have (since I was part of the Beta team and therefore already know a few developers, I might be able to help by knowing some alternative solution somone has come up with). Without the use-case (or at least the general type of use case like “I want to create a JSON covering all the node’s details” – you, of course, don’t need to post any specifics about your project
), this, unfortunately, is all the help I can provide.