Skip to content

json format with boolean attribute convert to string value #134

@zzq0324

Description

@zzq0324

Logstash information:

  1. Logstash version: logstash 8.1.2
  2. Logstash installation source: expanded from tar or zip archive
  3. How is Logstash being run: Via command line
  4. How was the Logstash Plugin installed: by default

OS version (uname -a if on a Unix-like system)
Darwin zhengzhq 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

Steps to reproduce:
I use http output plugin to send request to server, request body contains attributes and it's type is boolean. When request to server, it seems boolean value is convert to string, so the server response error.

  1. http output config info like below
http {
      format => "json"
      content_type => "application/json"
      http_method => "post"
      url => "https://open.feishu.cn/open-apis/bot/v2/hook/xxx"
      mapping => {
        msg_type => "interactive"
        card => {
          config => {
            wide_screen_mode => true
          }
          header => {
            template => "red"
            title => {
              content => "异常信息告警"
              tag => "plain_text"
            }
          }
        }
      }
    }
  1. server response
{"code":11246,"msg":"path: message->card; err_msg: json: cannot unmarshal string into Go struct field ConfigForm.config.wide_screen_mode of type bool; err_type: validation; ","data":{}}

anyone tell me how can i pass wide_screen_mode as boolean value to server?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions