Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Key Value Map, Value as JSON

Not applicable

Is there any way this would be possible? I wanted to assign for lets say a key "A" a value of {"hello":"Hello World!","barbie":"ken"}.

when i try doing that, there is an intermittent response of Malformed JSON: Expected ',' instead of '' anyone can help me ?

Solved Solved
0 8 1,522
1 ACCEPTED SOLUTION

Dear @Hanzel Garcia ,

Below Key Value Map policy works perfectly fine for me. Please let us know if it helps.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations name="putUrl" mapIdentifier="urlMapper">
    <Scope>apiproxy</Scope>
    <Put override="true">
        <Key>
            <Parameter ref="urlencoding.requesturl.hashed"/>
        </Key>
        <Value>{'hello':'Hello World!','barbie':'ken'}</Value>
    </Put>
    <Get assignTo="urlencoding.shorturl" index="1">
        <Key>
            <Parameter ref="urlencoding.requesturl.hashed"/>
        </Key>
    </Get>
</KeyValueMapOperations>

Cheers,

Anil Sagar

View solution in original post

8 REPLIES 8