Skip to content

Commit

Permalink
Update json-format.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kinclay authored Jan 13, 2025
1 parent dce7824 commit 18538d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/collections/_policies/json-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,11 @@ This field is a JSON array of template links. The JSON representation of a templ

`templateId` is the ID of the policy to be linked against. `new_id` is the ID of the newly generated template-linked policy, and `values` is a mapping from slots (`?principal` or `?resource`) to entities.

## Convert Cedar policy format to JSON policy format
## Convert Cedar policy format to JSON policy format using Java

If you have a policy statement in Cedar format, for example if you've used Amazon Verified Permission's [BatchGetPolicy](https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_BatchGetPolicy.html) API operation, and want to convert it to JSON policy format, follow these steps:
**Note**: These steps are specific to Java, the process will be different using other languages.

If you have a policy statement in Cedar policy format, for example if you've used Amazon Verified Permission's [BatchGetPolicy](https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_BatchGetPolicy.html) API operation, and want to convert it to JSON policy format, follow these steps:

1. Get the policy statement by calling the [parseStaticPolicy](https://github.com/cedar-policy/cedar-java/blob/main/CedarJava/src/main/java/com/cedarpolicy/model/policy/Policy.java) method.
2. Convert the policy statement to JSON by calling the [toJson](https://github.com/cedar-policy/cedar-java/blob/main/CedarJava/src/main/java/com/cedarpolicy/model/policy/Policy.java) method.
Expand Down

0 comments on commit 18538d4

Please sign in to comment.