Movatterモバイル変換


[0]ホーム

URL:


CFEngine documentation homepage

validjson

Suggest changes
Table of contents

Prototype:validjson(string)

Return type:boolean

Description: Validates a JSON container fromstring and returnstrue if the contents are valid JSON.

Arguments:

  • string:string - String to validate as JSON - in the range:.*

Example:

Run:

code
bundleagentmain{vars:"json_string"string=>'{"test":[1,2,3]}';reports:"This JSON string is valid!"if=>validjson("$(json_string)");"This JSON string is not valid."unless=>validjson("$(json_string)");}

Output:

code
R: This JSON string is valid!

See also:readjson(),validdata()

History: Was introduced in 3.16.0.

Still need help?

Chat Ask a question on Github Mailing list
Version 
master3.24 (LTS)3.21 (LTS)view all versions

[8]ページ先頭

©2009-2025 Movatter.jp