Project

General

Profile

Actions

Feature #4649

closed

Add a new JSON serialiser to change sibbling with same names in array

Added by Lequeux Olivier over 11 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Adaptors
Target version:
Start date:
06/12/2013
Due date:
% Done:

100%

Estimated time:

Description

Could be great to have '?accept=php_array' renderer to directly inject data from lavoisier in a
php array.

We can imagine to provide php object toot (like stdclass): to be discussed.

Actions #1

Updated by Lequeux Olivier over 11 years ago

  • Subject changed from PHP serialized array renderer to Add a new JSON serialiser to change sibbling with same names in array
Actions #2

Updated by Reynaud Sylvain over 11 years ago

  • Status changed from New to Feedback
  • Assigned To set to Lequeux Olivier

Since renderers must be able to render any XML data, this choice would produce quite complex JSON outputs:

<ul>
<li style="color:red">First Item</li>
<li title="Some hover text." style="color:green">
Second Item
</li>
<li><span class="code-example-third">Third</span>
Item</li>
</ul>
{
    "ul":
    {
        "li":
        [
            [
                { "style" : "color:red" },
                "First Item" 
            ],
            [
                {
                    "title" : "Some hover text.",
                    "style" : "color:green" 
                },
                "Second Item" 
            ],
            [
                {
                    "span":
                    [
                        { "class" : "code-example-third" },
                        "Third" 
                    ]
                },
                " Item" 
            ]
        ]
    }
}

Can you please confirm that such a complexity does not make this rendering useless?

Actions #3

Updated by Reynaud Sylvain over 11 years ago

  • Status changed from Feedback to New
  • Assigned To deleted (Lequeux Olivier)

Modify the existing JSON renderer.

Add parameters:

  • element-as-array=TRUE|false. If element-as-array, then sibling elements with same name are grouped into an array (<li>a</li><li>b</li> = "li":[]).
  • text-as-pair=TRUE|false. If text-as-pair, then text nodes are converted to pairs "#text": "value".
  • abort-on-conflict=true|FALSE. If abort-on-conflict, then conflicting names will raise an exception. Else conflicting names will be renamed to "name#1", "name#2"...

Text nodes are trimed, and empty text strings are ignored.

Namespaces will be ignored.

Actions #4

Updated by Reynaud Sylvain about 11 years ago

  • Category set to Adaptors
Actions #5

Updated by Reynaud Sylvain about 11 years ago

  • Priority changed from Low to Normal
Actions #6

Updated by Reynaud Sylvain about 11 years ago

<e:entries> et <e:entry> should be removed from generated JSON

Actions #7

Updated by Reynaud Sylvain almost 11 years ago

  • Status changed from New to Resolved
  • Assigned To set to Reynaud Sylvain
  • Target version set to 2.0
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF