EnergeticPulse opened a new pull request, #9916:
URL: https://github.com/apache/seatunnel/pull/9916

   ## Contribution Checklist
   - [x] Make sure that the pull request corresponds to a [GITHUB 
issue](https://github.com/apache/seatunnel/issues).
   - [x] Name the pull request in the form "[Bug] [http] Preserve nested JSON 
structure in request body"
   - [x] Minor fixes should be named following this pattern: `[hotfix] [docs] 
Fix typo in README.     md doc`.
   
   ### Purpose of this pull request
   
   This pull request fixes a bug in the HTTP connector where nested JSON 
request bodies (e.g., `{"user": {"name": "Alice"}}`) are incorrectly flattened 
into dot-separated keys like `{“user->name": "Alice"}` due to the use of 
`ConfigFactory.parseString()`.      This breaks compatibility with APIs that 
expect structured JSON payloads.      The fix replaces `ConfigFactory` with 
`JsonUtils.     parseObject()` to preserve the original nested structure.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   - **Previous behavior**: Nested JSON in the HTTP request body was flattened 
(e.g., `{"a": {"b": 1}}` → `{“a->b": "1"}`).
   - **New behavior**: Nested JSON is preserved as-is (e.g., `{"a": {"b": 1}}` 
remains a nested map).aaaaa
   This change ensures the HTTP connector sends correctly structured JSON to 
downstream services, which is the expected behavior for most REST APIs.      It 
is backward compatible for valid JSON inputs;      invalid JSON bodies fall 
back to an empty map (same as before).
   
   ### How was this patch tested?
   
   - Added unit tests in `HttpClientProviderTest.java`:
   - `testFixedBodyParsingPreservesNestedJsonStructure()`: verifies that nested 
objects, arrays, and primitives are correctly preserved after the fix.
   - Verified that all existing tests in `seatunnel-connector-http` still pass.
   - Manually tested with a sample HTTP sink configuration sending nested JSON 
to a mock server (confirmed correct payload structure).
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License 
Notice according [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [x] If necessary, please update the documentation to describe the new 
feature.      https://github.com/apache/seatunnel/tree/dev/docs
   → **Not needed**: This is a bug fix, not a new feature.
   * [x] If you are contributing the connector code, please check that the 
following files are updated:
   1.      Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
 → **Not needed**: No new connector added.
   2.      Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
 → **Not needed**.
   3.      Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
 → **Not needed**.
   4.      Add e2e testcase in 
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
 → **Not needed**: Unit tests are sufficient for this core logic fix.
   5.      Update connector 
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
 → **Not needed**.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to