@Jon: OK, I think I understand now – I had thought the proposal was to add JSON, so that MOMs could return JSON and JSON would be output into the accounting logs and would be available via qstat. I really love this idea. However, I now understand that is not what is being proposed. If I understand correctly, the proposal is that each MOM returns a string and those strings are captured into a single JSON-like object (that is only 1 level deep) with key’s corresponding to the MOM names. In particular, there is no way to represent any JSON value other than a single JSON object with keys and non-complex (e.g., string) values, so nested objects would not be supported.
To me, it makes sense to have a JSON format, but if PBS is not going to validate the syntax, then I suggest removing JSON entirely from the equation. In other words, every MOM would return a simple resource value string, and they would be concatenated. As long as PBS defines the order of concatenation, then it is possible for a hook writer to output legal JSON if so desired, but the onus would be completely on the hook writer. (And, of course, getting the leading and trailing elements, including the commas correct is a bit of a hook-writer’s hassle, but it is possible).
I would rather see PBS actually implement a JSON value type, do proper validation, and all, but I gather from your “file a ticket … we can look at adding it in the future” that the additional effort is not available at this time.
One additional note: While investigating about this, I did find the following in the PBS Reference Guide which disallows both types of quotes in a resource value. If PBS is going to start allowing this in the accounting logs, that may mess up some parsers that depend on the published interface. (At the very least, a big warning should be given in the release notes about potentially breaking backward compatibility.) From the PBS Reference Guide in the Formats section:
String (resource value)
Any character, including the space character.
Only one of the two types of quote characters, " or ', may appear in any given value.
Values:[_a-zA-Z0-9][[-_a-zA-Z0-9 ! " # $ % ́ ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ’ { | } ~] …]
String resource values are case-sensitive.
To summarize: I suggest either going full JSON or going full “strings with concatenation and nothing else”. Going partly JSON (as proposed) will make any future extensions to incorporate full JSON into PBS very messy to get right.