# 14.2 Ret

If the project to be upgraded has never used Ret, then this section can be ignored. If you are using jfinal 3.2, 3.3, 3.4, or higher versions of jfinal, you can also ignore this section.

JFinal 3.2 has improved the Ret utility class to make it more suitable for API projects that interact using JSON data formats. The new version has only one status name: state, with values of either "ok" or "fail." The old version has two status names: isOk and isFail, with values of either "true" or "false."

Therefore, the JSON data generated by the new and old versions of the Ret object will differ. For most web projects, the upgrade method is as follows:

  • Use the search and replace function to replace ret.isOk with ret.state == "ok" in HTML and JS files.

  • Use the search and replace function to replace ret.isFail with ret.state == "fail" in HTML and JS files.

If you want to minimize code changes during the upgrade, you can call the Ret.setToOldWorkMode() method to continue using the old version mode.

Last Updated: 9/22/2023, 7:59:19 AM