Has anyone used jsonStringToObject() successfully? This documentation:
uses the example code
{{jsonStringToObject(webResponse.body)}}
and claims that that can then be addressed using dot notation, but within Confluence automation I've tried
{{jsonStringToObject(page.body)}}
or for example
{{jsonStringToObject(page.body).type}} (which should return "doc")
and nothing is returned.
{{page.body}}, on its own, returns a string that validates as proper JSON text - so this SHOULD work. I.e. this appears to be a bug.
Speaking of which, the object {{page.body}} seems to be entirely undocumented - I know {{page.body.storage}} works, but I have not been able to find any other sub-elements of {{page.body}}. Any hints?
Background here is that I'm trying to iterate through the rows of a table, and what I'd LIKE to do is to return the rows as a "list" that I can then iterate using Automation's "FOR EACH" - otherwise I'll have to have 50+ IF clauses and use string extraction to grab each table row.
These smart value functions are only for automation in Jira.
Automation is not a product that acts the same as in Confluence and Jira.
Both products have automation, but have there own smart values as well.
https://support.atlassian.com/cloud-automation/docs/smart-values-in-confluence-automation/
In the API docs body is named, but not in any detail.
I have seen people access the page body in an automation rule by using the Confluence REST API together with the "Send web request" action.
You can access the HTTP response in later components with the {{webRequest.body}} smart value. So you could potentially use that smart value in a comparison condition to achieve your use case.
Thanks for the response. You may be on to something - {{page.body}} just returns text, so you would ASSUME that Atlassian would make the same text operators available - but maybe, inexplicably, they have not. I get that Jira and Confluence have different objects and hence different smart values - but again, this is just text, it would be my expectation that the same functions would be available.
I'll also note that the automation doesn't throw an error of any sort, like "jsonStringToObject() not supported" or anything USEFUL. So.
As for the {{page.body}} smart value itself, it definitely exists and will log text to the Audit log if you ask it to. You don't need to run a web request to get it. Other folks have mentioned it in other solutions, but it appears to not be documented.
So, I guess I'd say:
1. {{page.body}} definitely exists and will log text results
2. Although jsonStringToObject() isn't explicitly documented in the Confluence smart value documentation, NONE of the strong operators are - and yet many of them work, such as substringBetween() and so forth - so they clearly exist, but Atlassian has not gotten around to documenting them yet.
3. I would expect the set of string manipulation operators to be the same across Jira/Confluence, since it's a base type not something specific to either platform. Anything else would violate the principle of least surprise.
4. Since this function seems to silently fail without producing expected results (either a JSON object or an error), I would suggest this should be classified as a bug.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Based on the link and the tags in your request, it seems that the issue might be caused by trying to use Jira Automation smart values in Confluence Automation.
I couldn’t find the exact smart value you're using in the Confluence documentation: https://support.atlassian.com/cloud-automation/docs/smart-values-in-confluence-automation/
However, take a look- you might find something that better matches your needs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same reply as to Marc, above - could be a difference in platform, but really it seems like Confluence just hasn't caught up yet in the doco department. Strings are strings. Seems like a bug to me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.