Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the capacity to parse a JSON Object or JSON Array as a string in HTTP source plugins #65

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

VictorD-Veolia
Copy link

Some APIs might return JSON data with dynamically changing schema for some fields. Today, HTTP Source plugins are not able to handle this kind of data.

For example, in the following google API , the field 'customSchema' might have a changing schema.

This pull request add the capacity to parse a JSON object/array to a stringify value.

Here is an example :

Considering the following input data :

{
	"someField":"someValue",
	"customSchema":{
		"customInnerField1":"innerValue1",
		"customInnerField2":"innerValue2",
		"customInnerField3":"innerValue3"
	},
	"someObject":{
		"someId":"someValue",
		"someType":"someValue"
	}
}

Where 'customSchema' might contain a large and unknown number of 'customInnerField'.

With this new feature, the plugin can handle this data if the configuration field 'Authorize Parsing of Objects to String' is set to True, and the field 'customSchema' is defined as STRING in the output schema.

The output record would then be :

{
	"someField":"someValue",
	"customSchema":"{\"customInnerField1\":\"innerValue1\",\"customInnerField2\":\"innerValue2\",\"customInnerField3\":\"innerValue3\"}",
	"someObject":{
		"someId":"someValue",
		"someType":"someValue"
	}
}

Copy link
Contributor

@rmstar rmstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please create a Jira describing the feature and link to it here
  • Please fix merge conflicts
  • Please add a unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants