Parse JSON items Lasso 8.6 (Sparkpost)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Parse JSON items Lasso 8.6 (Sparkpost)

Laurent Gigon
Hi,

I need to extract bounces from my mailing list using JSON results from
Sparkpost.
How can I extract "msg_from" item from this result?

Here is a sample file :

[
  {
    "msys": {
      "message_event": {
        "type": "bounce",
        "bounce_class": "1",
        "campaign_id": "Example Campaign Name",
        "customer_id": "1",
        "delv_method": "esmtp",
        "device_token":
"45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
        "error_code": "554",
        "event_id": "92356927693813856",
        "friendly_from": "[hidden email]",
        "ip_address": "127.0.0.1",
        "ip_pool": "Example-Ip-Pool",
        "message_id": "000443ee14578172be22",
        "msg_from": "[hidden email]",
        "msg_size": "1337",
        "num_retries": "2",
        "rcpt_meta": {
          "customKey": "customValue"
        },
        "rcpt_tags": [
          "male",
          "US"
        ],
        "rcpt_to": "[hidden email]",
        "raw_rcpt_to": "[hidden email]",
        "rcpt_type": "cc",
        "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
        "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
        "routing_domain": "example.com",
        "sending_ip": "127.0.0.1",
        "sms_coding": "ASCII",
        "sms_dst": "7876712656",
        "sms_dst_npi": "E164",
        "sms_dst_ton": "International",
        "sms_src": "1234",
        "sms_src_npi": "E164",
        "sms_src_ton": "Unknown",
        "subaccount_id": "101",
        "subject": "Summer deals are here!",
        "template_id": "templ-1234",
        "template_version": "1",
        "timestamp": "1454442600",
        "transmission_id": "65832150921904138"
      }
    }
  },
  {
    "msys": {
      "message_event": {
        "type": "spam_complaint",
        "campaign_id": "Example Campaign Name",
        "customer_id": "1",
        "delv_method": "esmtp",
        "event_id": "92356927693813856",
        "fbtype": "abuse",
        "friendly_from": "[hidden email]",
        "ip_pool": "Example-Ip-Pool",
        "message_id": "000443ee14578172be22",
        "rcpt_meta": {
          "customKey": "customValue"
        },
        "rcpt_tags": [
          "male",
          "US"
        ],
        "rcpt_to": "[hidden email]",
        "raw_rcpt_to": "[hidden email]",
        "rcpt_type": "cc",
        "report_by": "server.email.com",
        "report_to": "abuse.example.com",
        "sending_ip": "127.0.0.1",
        "subaccount_id": "101",
        "subject": "Summer deals are here!",
        "template_id": "templ-1234",
        "template_version": "1",
        "timestamp": "1454442600",
        "transmission_id": "65832150921904138",
        "user_str": "Additional Example Information"
      }
    }
  }
]


Laurent

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Parse JSON items Lasso 8.6 (Sparkpost)

stevepiercy
local('json') = 'my JSON object';

iterate(decode_json(#json), local('i'));
    #i -> find('msys') -> find('message_event') -> find('msg_from');
    '<br>';
/iterate;

=>
[hidden email]

--steve


On 5/10/16 at 8:50 AM, [hidden email] (Laurent G) pronounced:

> Hi,
>
> I need to extract bounces from my mailing list using JSON results from
> Sparkpost.
> How can I extract "msg_from" item from this result?
>
> Here is a sample file :
>
> [
>   {
>     "msys": {
>       "message_event": {
>         "type": "bounce",
>         "bounce_class": "1",
>         "campaign_id": "Example Campaign Name",
>         "customer_id": "1",
>         "delv_method": "esmtp",
>         "device_token":
> "45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
>         "error_code": "554",
>         "event_id": "92356927693813856",
>         "friendly_from": "[hidden email]",
>         "ip_address": "127.0.0.1",
>         "ip_pool": "Example-Ip-Pool",
>         "message_id": "000443ee14578172be22",
>         "msg_from": "[hidden email]",
>         "msg_size": "1337",
>         "num_retries": "2",
>         "rcpt_meta": {
>           "customKey": "customValue"
>         },
>         "rcpt_tags": [
>           "male",
>           "US"
>         ],
>         "rcpt_to": "[hidden email]",
>         "raw_rcpt_to": "[hidden email]",
>         "rcpt_type": "cc",
>         "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
>         "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
>         "routing_domain": "example.com",
>         "sending_ip": "127.0.0.1",
>         "sms_coding": "ASCII",
>         "sms_dst": "7876712656",
>         "sms_dst_npi": "E164",
>         "sms_dst_ton": "International",
>         "sms_src": "1234",
>         "sms_src_npi": "E164",
>         "sms_src_ton": "Unknown",
>         "subaccount_id": "101",
>         "subject": "Summer deals are here!",
>         "template_id": "templ-1234",
>         "template_version": "1",
>         "timestamp": "1454442600",
>         "transmission_id": "65832150921904138"
>       }
>     }
>   },
>   {
>     "msys": {
>       "message_event": {
>         "type": "spam_complaint",
>         "campaign_id": "Example Campaign Name",
>         "customer_id": "1",
>         "delv_method": "esmtp",
>         "event_id": "92356927693813856",
>         "fbtype": "abuse",
>         "friendly_from": "[hidden email]",
>         "ip_pool": "Example-Ip-Pool",
>         "message_id": "000443ee14578172be22",
>         "rcpt_meta": {
>           "customKey": "customValue"
>         },
>         "rcpt_tags": [
>           "male",
>           "US"
>         ],
>         "rcpt_to": "[hidden email]",
>         "raw_rcpt_to": "[hidden email]",
>         "rcpt_type": "cc",
>         "report_by": "server.email.com",
>         "report_to": "abuse.example.com",
>         "sending_ip": "127.0.0.1",
>         "subaccount_id": "101",
>         "subject": "Summer deals are here!",
>         "template_id": "templ-1234",
>         "template_version": "1",
>         "timestamp": "1454442600",
>         "transmission_id": "65832150921904138",
>         "user_str": "Additional Example Information"
>       }
>     }
>   }
> ]
>
>
> Laurent
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.stevepiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Parse JSON items Lasso 8.6 (Sparkpost)

Laurent Gigon
it works :)

Thanks Steve!

Laurent

2016-05-12 14:27 GMT-04:00 Steve Piercy - Website Builder <[hidden email]>:

> local('json') = 'my JSON object';
>
> iterate(decode_json(#json), local('i'));
>     #i -> find('msys') -> find('message_event') -> find('msg_from');
>     '<br>';
> /iterate;
>
> =>
> [hidden email]
>
> --steve
>
>
> On 5/10/16 at 8:50 AM, [hidden email] (Laurent G) pronounced:
>
>> Hi,
>>
>> I need to extract bounces from my mailing list using JSON results from
>> Sparkpost.
>> How can I extract "msg_from" item from this result?
>>
>> Here is a sample file :
>>
>> [
>>   {
>>     "msys": {
>>       "message_event": {
>>         "type": "bounce",
>>         "bounce_class": "1",
>>         "campaign_id": "Example Campaign Name",
>>         "customer_id": "1",
>>         "delv_method": "esmtp",
>>         "device_token":
>> "45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
>>         "error_code": "554",
>>         "event_id": "92356927693813856",
>>         "friendly_from": "[hidden email]",
>>         "ip_address": "127.0.0.1",
>>         "ip_pool": "Example-Ip-Pool",
>>         "message_id": "000443ee14578172be22",
>>         "msg_from": "[hidden email]",
>>         "msg_size": "1337",
>>         "num_retries": "2",
>>         "rcpt_meta": {
>>           "customKey": "customValue"
>>         },
>>         "rcpt_tags": [
>>           "male",
>>           "US"
>>         ],
>>         "rcpt_to": "[hidden email]",
>>         "raw_rcpt_to": "[hidden email]",
>>         "rcpt_type": "cc",
>>         "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
>>         "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
>>         "routing_domain": "example.com",
>>         "sending_ip": "127.0.0.1",
>>         "sms_coding": "ASCII",
>>         "sms_dst": "7876712656",
>>         "sms_dst_npi": "E164",
>>         "sms_dst_ton": "International",
>>         "sms_src": "1234",
>>         "sms_src_npi": "E164",
>>         "sms_src_ton": "Unknown",
>>         "subaccount_id": "101",
>>         "subject": "Summer deals are here!",
>>         "template_id": "templ-1234",
>>         "template_version": "1",
>>         "timestamp": "1454442600",
>>         "transmission_id": "65832150921904138"
>>       }
>>     }
>>   },
>>   {
>>     "msys": {
>>       "message_event": {
>>         "type": "spam_complaint",
>>         "campaign_id": "Example Campaign Name",
>>         "customer_id": "1",
>>         "delv_method": "esmtp",
>>         "event_id": "92356927693813856",
>>         "fbtype": "abuse",
>>         "friendly_from": "[hidden email]",
>>         "ip_pool": "Example-Ip-Pool",
>>         "message_id": "000443ee14578172be22",
>>         "rcpt_meta": {
>>           "customKey": "customValue"
>>         },
>>         "rcpt_tags": [
>>           "male",
>>           "US"
>>         ],
>>         "rcpt_to": "[hidden email]",
>>         "raw_rcpt_to": "[hidden email]",
>>         "rcpt_type": "cc",
>>         "report_by": "server.email.com",
>>         "report_to": "abuse.example.com",
>>         "sending_ip": "127.0.0.1",
>>         "subaccount_id": "101",
>>         "subject": "Summer deals are here!",
>>         "template_id": "templ-1234",
>>         "template_version": "1",
>>         "timestamp": "1454442600",
>>         "transmission_id": "65832150921904138",
>>         "user_str": "Additional Example Information"
>>       }
>>     }
>>   }
>> ]
>>
>>
>> Laurent
>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>>   the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.stevepiercy.com/>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>