ChaiScript icon indicating copy to clipboard operation
ChaiScript copied to clipboard

Question: How to to_json my struct ?

Open DexterMagnific opened this issue 4 years ago • 0 comments

Hi,

I came across this fantastic piece of work and it's amazing. Was searching for something like this for a while. Congrats !

I'd like to ask: how to get a JSON string for my struct without going through the script eval() ?

I see that json_wrap::to_json() takes a boxed value (so a value returned from a script).

  • How can I manage to get a boxed value from a C++ value (custom struct) directly ?
  • Do I have to register my custom struct type to Chai first ?

Thanks.

DexterMagnific avatar Sep 21 '21 09:09 DexterMagnific