Hi there,

While playing openapi with ofbiz, I found it would more convenient to get some 
view entity results in json format. I tried array-to-json of PostgreSQL, it 
worked.

A sample use case:
    <view-entity entity-name="VWProductAttribute"
                 package-name="org.langhua.sandflower.luca.product"
                 never-cache="true"
                 title="VWProductAttribute">
        <member-entity entity-alias="PA" 
entity-name="ProductAttribute"></member-entity>

        <alias entity-alias="PA" name="productId" group-by="true"></alias>
        <alias entity-alias="PA" name="attrNames" field="attrName" 
function="array-to-json"></alias>
        <alias entity-alias="PA" name="attrValues" field="attrValue" 
function="array-to-json"></alias>
        <alias entity-alias="PA" name="attrDescriptions" 
field="attrDescription" function="array-to-json"></alias>
    </view-entity>

And then the result could be sent to front-end(react/vue/angular) directly.

Kind Regards,

Shi Jinghai

Reply via email to