Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions source/plugins/json/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,19 @@ given result add encoding param as below:
</result>
```

### Customizing the output

Since Struts 2.5.14, you can implement the `org.apache.struts2.json.JSONWriter` interface to customize the generated json response.
The implementation should then be defined in `struts.xml` like:

```xml
<struts>
<bean type="org.apache.struts2.json.JSONWriter" name="myJSONWriter" class="com.mycompany.MyJSONWriter"
scope="prototype"/>
<constant name="struts.json.writer" value="myJSONWriter"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</struts>
```

## Example

### Setup Action
Expand Down