0

我收到了一组 JSON 格式的对象的请求。我想在速度映射模板中将这些对象转换为单行 JSON (JSONL)。这可能吗?

来自:

[
 {
  "something": "else",
  "another": "thing"
 },
 {
  "something": "else",
  "another": "thing"
 }
]

进入

{ "something": "else", "another": "thing" }
{ "something": "else", "another": "thing" }

任何帮助将非常感激。

4

1 回答 1

0

类似的东西?

#foreach( $entry in $array )

  ## make sure $entry is a string
  #set( $entry = "$entry" )

  ## merge lines
  #set( $entry = $entry.replaceAll('\n', '') )

  ## print line
  $entry
#end
于 2020-12-14T18:18:33.503 回答