🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Extracting text from a record

User: "paul_balas"
New Altair Community Member
Updated by Jocelyn
Hi,

Is there an easy control to use to extract the text from the following field:

{

  "data": {

    "translations": [

      {

        "translatedText": "020114 - SECURITAS - Security - AE Menor - 14x7 - Van",

        "detectedSourceLanguage": "es"

      }

    ]

  }

}

I want to extract just the following text:  020114 - SECURITAS - Security - AE Menor - 14x7 - Van

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "sgenzer"
    Altair Employee
    Accepted Answer
    hi all - so yes that is very good "sorcery" @rfuentealba. The reason is that the existing JSON parsing tools are currently out-of-date. There are some updates in the pipeline but to be honest, I would STRONGLY suggest just using Old World Computing's new Web Automation extension (from the marketplace). I can do your JSON parsing very elegantly in about 2 min like this:

    <?xml version="1.0" encoding="UTF-8"?><process version="9.2.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.2.000" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" breakpoints="after" class="text:create_document" compatibility="8.1.000" expanded="true" height="68" name="Create Document" width="90" x="45" y="34">
            <parameter key="text" value="{&#10;&#10;  &quot;data&quot;: {&#10;&#10;    &quot;translations&quot;: [&#10;&#10;      {&#10;&#10;        &quot;translatedText&quot;: &quot;020114 - SECURITAS - Security - AE Menor - 14x7 - Van&quot;,&#10;&#10;        &quot;detectedSourceLanguage&quot;: &quot;es&quot;&#10;&#10;      }&#10;&#10;    ]&#10;&#10;  }&#10;&#10;}"/>
            <parameter key="add label" value="false"/>
            <parameter key="label_type" value="nominal"/>
            <description align="center" color="transparent" colored="false" width="126">this is your JSON</description>
          </operator>
          <operator activated="true" breakpoints="after" class="text:documents_to_data" compatibility="8.1.000" expanded="true" height="82" name="Documents to Data" width="90" x="179" y="34">
            <parameter key="text_attribute" value="json"/>
            <parameter key="add_meta_information" value="false"/>
            <parameter key="datamanagement" value="double_sparse_array"/>
            <parameter key="data_management" value="auto"/>
          </operator>
          <operator activated="true" class="rmx_webautomation:process_json_object" compatibility="2.2.431" expanded="true" height="82" name="Process Object" width="90" x="179" y="238">
            <process expanded="true">
              <operator activated="true" class="rmx_webautomation:process_json_object" compatibility="2.2.431" expanded="true" height="82" name="Process Object (2)" width="90" x="179" y="34">
                <parameter key="property_name" value="data"/>
                <process expanded="true">
                  <operator activated="true" class="rmx_webautomation:process_json_array" compatibility="2.2.431" expanded="true" height="82" name="Process Array" width="90" x="179" y="34">
                    <parameter key="property_name" value="translations"/>
                    <parameter key="array_type" value="objects"/>
                    <parameter key="create_id_attribute" value="false"/>
                    <process expanded="true">
                      <operator activated="true" class="rmx_webautomation:extract_json_properties" compatibility="2.2.431" expanded="true" height="82" name="Extract Properties" width="90" x="112" y="34">
                        <list key="extract_properties">
                          <parameter key="translatedText" value="translatedText.polynominal"/>
                        </list>
                        <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
                        <parameter key="time zone" value="SYSTEM"/>
                      </operator>
                      <operator activated="true" class="rmx_webautomation:commit_row" compatibility="2.2.431" expanded="true" height="82" name="Commit Row" width="90" x="246" y="34"/>
                      <connect from_port="parse specification" to_op="Extract Properties" to_port="parse specifications 1"/>
                      <connect from_op="Extract Properties" from_port="parse specifications 1" to_op="Commit Row" to_port="parse specifications 1"/>
                      <connect from_op="Commit Row" from_port="parse specifications 1" to_port="parse specifications 1"/>
                      <portSpacing port="source_parse specification" spacing="0"/>
                      <portSpacing port="source_input 1" spacing="0"/>
                      <portSpacing port="sink_parse specifications 1" spacing="0"/>
                      <portSpacing port="sink_parse specifications 2" spacing="0"/>
                    </process>
                  </operator>
                  <connect from_port="parse specification" to_op="Process Array" to_port="parse specification"/>
                  <connect from_op="Process Array" from_port="parse specifications 1" to_port="parse specifications 1"/>
                  <portSpacing port="source_parse specification" spacing="0"/>
                  <portSpacing port="source_input 1" spacing="0"/>
                  <portSpacing port="sink_parse specifications 1" spacing="0"/>
                  <portSpacing port="sink_parse specifications 2" spacing="0"/>
                </process>
              </operator>
              <connect from_port="parse specification" to_op="Process Object (2)" to_port="parse specification"/>
              <connect from_op="Process Object (2)" from_port="parse specifications 1" to_port="parse specifications 1"/>
              <portSpacing port="source_parse specification" spacing="0"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="sink_parse specifications 1" spacing="0"/>
              <portSpacing port="sink_parse specifications 2" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="rmx_webautomation:parse_json_data" compatibility="2.2.431" expanded="true" height="103" name="Parse JSON from Data" width="90" x="380" y="85">
            <parameter key="attribute" value="json"/>
            <parameter key="keep_example_set" value="false"/>
          </operator>
          <connect from_op="Create Document" from_port="output" to_op="Documents to Data" to_port="documents 1"/>
          <connect from_op="Documents to Data" from_port="example set" to_op="Parse JSON from Data" to_port="example set"/>
          <connect from_op="Process Object" from_port="parse specifications 1" to_op="Parse JSON from Data" to_port="parse specifications 1"/>
          <connect from_op="Parse JSON from Data" from_port="example set 1" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>

    Scott
    User: "paul_balas"
    New Altair Community Member
    OP
    Accepted Answer
    Much easier!  Disappointing that some of these controls are so buggy.  This solved a problem I've been struggling with for about 4 hours.  Thank you!