cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How can I use json file in Thingworx Composer..?

hkim-51
1-Visitor

How can I use json file in Thingworx Composer..?

Hello, I'm Sol

I have some questions. I wanna use Json file in Thingworx but I don't know how to use in Thingworx Composer.

//-------start-----------

$subscriptionKey = '440dd540-8db1-3f5d-806e-9b15d5b4bece';


getWeather();


function getWeather() {

$subscriptionKey = '440dd540-8db1-3f5d-806e-9b15d5b4bece';

   

$(function() {

     var params = {

            version: 1,

            city : "서울",

            county : "강남구",

            village : "도곡동"

};

        //http://apis.skplanetx.com/weather/forecast/3hours?

$.ajax({

url: "http://apis.skplanetx.com/weather/current/minutely?" + $.param(params),

beforeSend: function(xhrObj){

// Request headers

xhrObj.setRequestHeader("appKey",'440dd540-8db1-3f5d-806e-9b15d5b4bece');

},

type: "GET",

// Request body

data: "{body}",

})

.done(function(data) {

document.write("successss");

         

            document.write(JSON.stringify(data));

            //console.table(data);

           

})

.fail(function() {

alert("error");

});

});

}

//----------end--------------

that is my jason file code and I wanna print this code in thingworx.

/*----------start----------------*/

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>weather info</title>

<style>

</style>

</head>

<body>

      

    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>

    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<script type="text/javascript" src="test.js"></script>

<div class="result">

<p id="resultInfo">ggg </p>

    </div>


    <script type="test/javascript">

       

   

    </script>

   


</body>

</html>


/*----------end----------------*/


That information is forecast information from south Korea.


Can I connect this kind of code with Thingworx? I just need to print weather values in Thing worx.

3 REPLIES 3
PaiChung
22-Sapphire I
(To:hkim-51)

In Thingworx for XML it uses E4X so that if you read an XML page it become an object that you can traverse as nodes.

Same for JSON if you read something in as JSON object it can be traversed as nodes, if the JSON is an Array then it will be nodeVariable.array.[nameofnode]

Could explain more detail..? How can I use that javascript code in Thinsworx Composer?

It looks like you are trying to bro g javascript libraries. Take a look at Widget Extensions Using AAGRID a JS library

Announcements


Top Tags