Skip to content

list of children nodes should be combined under a single parent node (builder) #748

Closed
@amitguptagwl

Description

@amitguptagwl

Discussed in #552

Originally posted by Effodero March 1, 2023
I have the following JSON

{
	"ExternalId": "123456-01",
	"Name": "Product name",
	"Attributes": [
		{
			"Attribute": {
				"@_id": "FAMILY",
				"Value": "family "
			}
		},
		{
			"Attribute": {
				"@_id": "EXPAND",
				"Value": "expanded-family"
			}
		}
	]
}

and trying to produce this output

<Product>
	<ExternalId>123456-01</ExternalId>
	<Name>Product name</Name>
	<Attributes>
		<Attribute id="FAMILY">
			<Value>123456</Value>
		</Attribute>
		<Attribute id="EXPAND">
			<Value>123456-01</Value>
		</Attribute>
	</Attributes>
</Product>

I've tried different settings, formatted JSON in couple of different ways, but keep getting

<Product>
	<ExternalId>123456-01</ExternalId>
	<Name>Product name</Name>
	<Attributes>
		<Attribute id="FAMILY">
			<Value>123456</Value>
		</Attribute>
	</Attributes>
	<Attributes>
		<Attribute id="EXPAND">
			<Value>123456-01</Value>
		</Attribute>
	</Attributes>
</Product>

I need to format the "Attributes" section as per the first snippet. Is this possible? Is there a specific way to prefix the JSON properties?

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