Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

Show all

JSON Parameter Parsing Error

Updated on 2023-11-28 GMT+08:00

Symptoms

JSON parameters are not replaced or parsed as expected during the Ansible application deployment.

During the Ansible application deployment, the template module can be used to replace a text file. If the parameter values in the file are in JSON or JSON array format, the character u will be added in front of the keys and values after parsing. For example:
  • Input parameters: {"key":"jsonkey","value":"jsonvalue"}
  • Parameters after replacement: {u'value': u'jsonvalue', u'key': u'jsonkey'}

Solution

Enclose JSON parameters with single quotation marks. The template module will forcibly parse the parameters in character string mode to ensure correct replacement. The following is an example:

  • Input parameters: '{"key":"jsonkey","value":"jsonvalue"}'
  • Parameters after replacement: {"key":"jsonkey","value":"jsonvalue"}
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback