I'd like to use jsonUtils in a script (not a webscript).
My intent is to convert a javascript object to json.
My understanding is that it's available to webscripts but not scripts.
Is there any way I can configure Alfresco to make it available to regular scripts? Is there something similar that's already available to regular scripts?
If not, is it possible to call a webscript from a script? How would I do so?
Can you explain what you see as the difference between a webscript and a script? Do you mean using Javascript on the client side (in the browser) or do you mean scripts in Rules and behaviours?
I had exactly this problem. According to the documentation jsonUtils should be available in any script that runs in the repository context (alfresco) which unless someone tells me otherwise rule scripts do; except, as you have found, out it isn't available or at least wasn't available in 4.0a (I haven't tried it in 4.2c). See my post
All you need to do is include the java bean that provides jsonUtils in the configuration of root objects in rules. I never got round to doing this (but I probably will have to soon) so I cannot give you chapter and verse on how you do this (hopefully someone on the forums can do this).
I have added my own objects in rules,so it has to be achievable, but in the end I didn't bother with jsonUtils.