Git Product home page Git Product logo

yaml2json's Introduction

yaml2json 1.0.0

Converts incoming json, xml or properties to json, xml or properties.



About yaml2json

This yq based service can convert incoming json, xml, csv, tsv or properties data into the same formats. The incoming data can be a string, file path or base64-encoded string.

Example(s)

Function Configuration

functions:
- id: yaml2json
  image: direktiv/yaml2json
  type: knative-workflow

String

- id: convert
  type: action
  action:
    function: yaml2json
    input:
      data: 'hello: world'
      output-format: json
      input-type: string

File

- id: set
  type: setter
  variables:
  - key: indata
    scope: instance
    mimeType: text/plain
    value: 'hello: world'
  transition: modify
- id: modify 
  type: action
  action:
    function: yaml2json
    files:
      - key: indata
        scope: instance
    input: 
      data: indata
      output-format: json
      input-type: file

Base64

- id: convert
  type: action
  action:
    function: yaml2json
    input:
      data: aGVsbG86IHdvcmxk
      output-format: xml
      input-type: base64

Request

The service requires only the data field but can accept different data types.

Request Attributes

PostParamsBody

Response

nice greeting

Reponse Types

PostOKBody

Example Reponses

"Hello YourName"

Errors

Type Description
io.direktiv.command.error Command execution failed
io.direktiv.output.error Template error for output generation of the service
io.direktiv.ri.error Can not create information object from request

Types

postOKBody

Properties

Name Type Go type Required Default Description Example
output PostOKBodyOutput PostOKBodyOutput

postOKBodyOutput

Properties

Name Type Go type Required Default Description Example
result interface{} interface{}
success boolean bool

postParamsBody

Properties

Name Type Go type Required Default Description Example
data string string โœ“ Depending on the input-type this value can be a file path, base64 string or a plain string. aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==
input-format string string "yaml" Input format. Possible values are yaml,xml,prop. xml
input-type string string "string" base64
output-format string string "json" Output format. Possible values are yaml, json, props, csv, tsv, xml. json

yaml2json's People

Contributors

alankm avatar jensg-st avatar

Watchers

 avatar

Forkers

alankm

yaml2json's Issues

Whitespace bug in shell script.

This line in the shell script is incorrect:

echo $input | yq -p $2 -o $3

The echo needs to be in quotes or the whitespace is destroyed, making the yaml invalid.

echo "$input" | yq -p $2 -o $3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.