JSON

633

Solutions

638

Contributors

JavaScript Object Notation, or JSON, is human-readable text used when transmitting data objects consisting of attribute:value pairs between a server and a web application as an alternative to XML. JSON, while it is originally derived from JavaScript, is a language-independent data format. Code for parsing and generating JSON data is available in many programming languages.

Share tech news, updates, or what's on your mind.

Sign up to Post

The purpose of code below is to get data in table from url source.

Short description of actual situation:
On main page i have a button to redirect to *.php page in code snippet bellow.

With name="button1" I am getting  data

and with id="newButtonID" I am  inserting it in  new row in tables.

I have intention to use select element to chose from time options (5min,15min, 60min) and fill new row with new data. (no any code about it for now, but i did add it because i presume that it will need it for timer interval)

My problem:
Before i continue with code-page logics construction I need a solution how to perform refreshing of data after specific time period.

Pleas instruct me how to reach this goal.

Thank you

<?php
if (isset($_POST['button1'])) 
{ 
$url="https://www.....";
$sfgc=file_get_contents($url);
$json=json_decode($sfgc,true);
$last= $json["last"];
//echo $json["last"];
$timestamp= $json["timestamp"];
//echo $json["timestamp"];
$date = new DateTime("@$timestamp");
$date2= $date->format('Y-m-d H:i:s') . "\n";
} 
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>BTC</title>

<style type="text/css">
#timeBtcID{ 
    float: left;
    margin: 10px;
    /* background-color: #e6f2ff;
    border-style: solid;
    border-width: 1px;*/
}
#newBtcID{ 
    float: left;
    margin: 10px;
    /* background-color: #e6f2ff;
    border-style: solid;
    border-width: 1px;*/
}

#oldBtcID{ 
     float: left;
    margin: 10px;

Open in new window

0
Free Tool: ZipGrep
LVL 12
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

we want to use https://www.espocrm.com/ as our primary CRM. but I just do not know how to create API with them.
They have very limited documentation about that.

And if you know how to create CRUD API with this crm, please help me. and I will be really appreciated your helps.
Currently, I have MVC website and can use jquery/ajax to create json to call. I am very new to do that so if you can show me examples in codes....that will be awesome.
0
Hello Experts

I have a created an ARM template in Visual Studio, and I need to package the JSON files so that I can use the option in Octopus Deploy to deploy the JSON files within the ARM template as a package - as described in the following link, under section 'Template Contained in a Package

https://octopus.com/docs/deploying-applications/azure-deployments/resource-groups

The problem is that I don't know what application in Visual Studio to package the application? I did some research and I read that the best package to use in nuspec as described here:

https://dinventive.com/blog/2016/10/20/5-steps-and-under-30-minutes-to-deploy-arm-templates-via-octopus-deploy/

However, there are a whole bunch of nuspec applications. The closet I got to what I need is the NuGetToolsPackager, as shown in the image.

Example Project
However, if there are any other suggestions, they will be most welcome.
0
Are there any user's out there familiar with CT FreitRater v 3.0 and interacting with the web service via JSON?
0
Looking for a way to add more than one JSON file to the script, below to produce a single CSV, but with multiple rows.  Each row should include the same number of fields and attributes, but be tied to a single JSON (ROW 1 = JSON 1, ROW 2 = JSON 2, etc.).  The following produces a CSV with one row of data from a single JSON.

import pandas as pd
df = pd.read_json("pywu.cache.json")
df = df.loc[["station_id", "observation_time", "weather", "temperature_string", "display_location"],"current_observation"].T
df = df.append(pd.Series([df["display_location"]["latitude"], df["display_location"]["longitude"]], index=["latitude", "longitude"]))
df = df.drop("display_location")
print(df['latitude'], df['longitude'])
df = pd.to_numeric(df, errors="ignore")
pd.DataFrame(df).T.to_csv("CurrentObs.csv", index=False, header=False, sep=",")

Open in new window

0
Hey all this is the first time I am using an thepirat000 Audit.MVC package and I have the base down and working just fine:
[Audit(EventTypeName = "InsertOrderAction", IncludeHeaders = true, IncludeModel = true)]
public ActionResult Index()
{
     var auditScope = this.GetCurrentAuditScope();

     auditScope.Comment("New comment from controller");
     auditScope.SetCustomField("TestField", Guid.NewGuid());

     return View();
}

Open in new window

Which outputs to a .json file and looks like this:
{
  "EventType": "InsertOrderAction",
  "Environment": {
    "UserName": "XXXXXXX",
    "MachineName": "XXXXXXX",
    "DomainName": "XXXXX",
    "CallingMethodName": "auditing.Controllers.HomeController.Index()",
    "AssemblyName": "auditing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
    "Culture": "en-US"
  },
  "Comments": [
    "New comment from controller"
  ],
  "StartDate": "2018-02-20T10:32:16.7258207-05:00",
  "EndDate": "2018-02-20T10:33:29.1468164-05:00",
  "Duration": 72421,
  "Action": {
    "HttpMethod": "GET",
    "ControllerName": "Home",
    "ActionName": "Index",
    "ViewName": "Index",
    "ViewPath": "~/Views/Home/Index.cshtml",
    "FormVariables": {},
    "ActionParameters": {},
    "UserName": "XXXX\\XXXXXXX",
    "RequestUrl": "/",
    "IpAddress": "127.0.0.1",
    "ResponseStatus": "200 OK",
    "ResponseStatusCode": 200,
    "Headers": {
      "Connection": "Keep-Alive",
      "Accept":

Open in new window

0
This is a spin-off of another thread: I am needing a way to add markers to Google Map, based-on geo-coordinates from an external JSON file.  The JSON file is stored locally on my web server and is being called to display information within a map window.   Additionally, I am looking for a similar method for calling a url to display a custom marker for each location.  The URL would also be stored in the same JSON file.

Below, is my code:

function initMap() {
        var hc = {lat: 40.466442, lng: -85.362709};
        var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 12,
            center: hc
        });

        var infowindow = new google.maps.InfoWindow({
            content: obj
        });

        var iconBase = "http://icons.wxug.com/i/c/k/cloudy.gif";
            var marker = new google.maps.Marker({
                position: hc,
                map: map,
                title: 'Hartford City',
                icon: iconBase
            });

        marker.addListener('click', function() {
            infowindow.open(map, marker);
        });
    }

    var downloadJSON = function() {
        $.getJSON( "ajax/GeoObs.json?_="+new Date().getTime(), function( data ) {
            var items = [];
            items.push( "<li id='Weather'>Station: " + 

Open in new window

0
Issue with MS Build. Trying to set up a queue from VSTS and failing in build solution.

Here is the desc.

Starting: Build solution
******************************************************************************
==============================================================================
Task         : Visual Studio Build
Description  : Build with MSBuild and set the Visual Studio version property
Version      : 1.126.0
Author       : Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613727)
==============================================================================
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe" "D:\a\1\s\$\CodeBase\ToolDevBranch3.32\rei.sln" /nologo /nr:false /t:"Clean" …
0
Hi,

I have a text file which has multiple json rows in it.

What I need to do is the following:-

1. Read thru the file
2. Select only certain elements not all, remap to a new name for example AuthenticationId could be AuthId
3. Ingest in to MongoDB as JSON

How can this be achieved in Python?

{"AuthenticationId":"997","CommandLine":"C:\\Windows\\system32\\wbem\\wmiprvse.exe -secured -Embedding","ConfigBuild":"1007.3.0005907.1","ConfigStateHash":"3163607488","EffectiveTransmissionClass":"3","Entitlements":"15","ImageFileName":"\\Device\\HarddiskVolume3\\Windows\\System32\\wbem\\WmiPrvSE.exe","ImageSubsystem":"2","IntegrityLevel":"16384","MD5HashData":"1df2fc82b861bc9612657d1661e9ae33","ParentAuthenticationId":"997","ParentProcessId":"1627804482161","ProcessCreateFlags":"16","ProcessEndTime":"","ProcessParameterFlags":"24577","ProcessStartTime":"1512962460","ProcessSxsFlags":"64","RawProcessId":"9276","SHA1HashData":"1aa3fda50123dd14a055b4d6601beedead69fe11","SHA256HashData":"835f2a94e47830b06654e484bf7a1cc0b9882f579716dca198e32d22218a07e5","SourceProcessId":"1627804482161","SourceThreadId":"39913451443946","TargetProcessId":"1756187997441","TokenType":"2","UserSid":"S-1-5-19","aid":"2bc82f8878df4b9f7712273e755a93be","aip":"105.255.135.108","cid":"99cdff8f89af458d858c3d6b3e312e11","event_platform":"Win","event_simpleName":"ProcessRollup2","id":"4ff73eae-de22-11e7-a0dd-06e913674db2","name":"ProcessRollup2V6","timestamp":"1512962460994"}

Open in new window



Open in new window

0
Visual Studio Pop ups are really annoying.   People are writing these add in's for visual studio and forgetting to deal with the intellisense pop ups.  The problem I have is the python add in / support...  Apparently there is a JSON attribute that can help with this  {"editor.parameterHints": false}  but I don't know where to put this parameter and I don't know much about visual studio add in development.

Can you tell 1) How to turn off pop-up's specifically for the python editor?  or 2) What file can i put this attribute in to turn this off?
The pop ups pop right in front of code that I have need to edit... It's crazy


---------------Below is a copy from my about box to show python editor version.---------------

Microsoft Visual Studio Community 2017
Version 15.2 (26430.12) Release
VisualStudio.15.Release/15.2.0+26430.12
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA166
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA166
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA166
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package   8.6.00404.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

Azure App Service Tools v3.0.0   15.0.30209.0
Azure App Service Tools v3.0.0

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services …
0
Free Tool: IP Lookup
LVL 12
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

How to post JSON api using cfhttp
0
Hello Experts,

Can someone please let me know the major benefits of using Hashicorps Terraform instead of Azure ARM?

I know that Terraform is provider agnostic (it can be used with any cloud provider), and I'm aware that its more readable than Azure JSON script.

However, because I no desire to train on AWS, or on Google's Cloud platform, I would like to know what how I would benefit from learning and adopting Terraform if I plan on staying an Azure Cloud solution engineer?

Thanks

Carlton
0
And the image url f remote location is given in json response...how do i parse and display that in list view...parsing is done andvi cud display the text and details which s so fast over the network...but how do i retrieve the images and display it in list view imagelist appearence
0
Hi I would like to toggle on or off just a piece of Front end code inside a component (Existing/New)

The desired flow as follows,

* dev completes work which is only to be made available on the live site on a certain date
* dev creates a toggle for the feature, and pushes the change live with the feature toggled off
* once the desired date has arrived, a person (someone with sufficient access) can make a simple content change to turn the toggle on, and publishes the change
* the feature is now available on the live site

Any help with Ideas on how to make this possible or code?

Thanks
0
I'm trying to read the latitude and the longitude from the device's current location and use these data to retrieve information from maps.googleapis.com. I'm correctly able to find the user location, but I'm not able to use the latitude and longitude values outside the onConnected() method.

When I try to read url from GetContacts() class, latitude and longitude are always NULL.

I declared url as global at the top of the ListLoc class in this way:

public String url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longitude+"&radius=1500&type=restaurant&key=AIzaSyAEDCSCA9yVaKhV7UNNcuGV8CaUlsBVNQE";

Open in new window


I tried to read the variables inside the OnConnected() method in this way:

latitude = mLocation.getLatitude();
longitude = mLocation.getLongitude();

Open in new window


Please, can you give me some suggestions on how to solve my problem? I tried to use global variables, but I didn't solve the issue.

I need to pass the variable url to makeServiceCall() with the correct latitude and longitude.
I would like to know why I get this error and how I can solve it.
Thank you a lot!



This is my whole code:

package skeetty.skeetty;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import android.app.ProgressDialog;
import android.os.AsyncTask;
import 

Open in new window

0
Hello, I trying to get and populating items from my dreamfactory Api.
If i get the url and api key on the browser i see a JSON but when i do a client.ExecuteAsync<ListItems>(request,(response) => {Console.WriteLine(response.Content)});
I saw i retrieving a xml ... really confusing
I try a lot samples from RestSharp, Xamarin TodoRest samples ,... no one works and i thing probably is because i still without be sure about if is XML or JSON ... someone was work before with dreamfactory api and xamarin forms for cross-platform api ?
Will be really helpful if someone can advice me about whats happend.
0
Hello there

I have form on domino application wherein I can select number of records ( each of records is in HTML and have check box, with name and date data }

When user selects the records in the form and clicks on process/print html data for selected user using button, I would like to open another page wherein they will see html reports for selected user. ( i have view for all the users )

I know json and ajax to post data using agent, here I am not sure how to redirect to another page using ajax and json data to it.

Please help.
0
[{"name":"Name1","date":"16/01/2016"},{"name":"Name2","date":"12/12/2017"}]

I have above data which is been send using ajax json Probably POST method.

Now my question is that How I can parse this data into Lotusscript agent ?
0
<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
    <style>
        <style>
   body{ margin:2em;}
      fieldset { display:inline-block;border:1x solid red; padding: 0px 40px 0px 20px; }
      legend {
        padding: 0.2em 0.5em;
        border:1px solid red;
        color:#fff;
        background-color:red;
        font-size:90%;
        width:auto;
      }
      #raidFrieght{
            margin: 10px 0px 10px 0px;
            padding-bottom: 4%;
      }
    table,
    th,
    td {
    border: 1px Solid black;
    border-collapse: collapse;
    }
    th {
    background-color: red;
    color: #fff;
    }
    </style>
</head>
<body>
    <div ng-app="myApp" ng-controller="myController">
      <fieldset>
        <legend> <b>Port Cost <b> </legend>
            <tr style="padding-right:10px;"> Rate </tr>
            <input style="margin-left:4%;" id="rbl_ratetype_0" type="radio" name="rbl_ratetype" value="1" checked="checked" />
            <label for="rbl_ratetype_0">Inbound</label>
            <input style="margin-left:4%;" id="rbl_ratetype_1" type="radio" name="rbl_ratetype" value="2" onclick="javascript:setTimeout('__doPostBack(\'rbl_ratetype$1\',\'\')', 0)" />
            <label for="rbl_ratetype_1">Outbound</label>
            </tr>
            </tr>
       
  <!--CREATE A TABLE-->
        <table>
            <tr>
               <th style="width:5%">SNo</th>
                        <th Style="width:30%">CostHead</th>
               …
0
Receive 1:1 tech help
LVL 12
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Hi,

I am in the process of building a call to a rest service.  I am correctly making the calls to the service etc, but I am having a slight issue with pulling specific data out.

Given the below response:

"{"nextpageuri":null,
"previouspageuri":null,
"sms_messages":
[{"created":"Fri, 08 Dec 2017 03:34:55 +0000",
"id":"cf4083fd852758af8bca5cffb77771d7",
"from":"0419000000","destination":"61417000000",
"message":"SAMPLE MSG",
"uri":"\/2016-11-30\/sms\/cf4083fd852758af8bca5cffb77771d7",
"receipts":{"delivered":"Fri, 08 Dec 2017 03:34:58 +0000"}}],"message":"Response follows","api_version":"2016-11-30","status":200,"uri":"\/2016-11-30\/sms\/cf4083fd852758af8bca5cffb77771d7"}"

Open in new window


This is what I am attempting to use to seperate out the receipts:
  // MAKE AN OBJECT
$Callresult = json_decode($response);
echo "attempt 1:".$response->sms_messages[0]->receipts;

But I keep getting an error of:
Notice:  Trying to get property of non-object

and if I try:
echo "attempt 1:".$response->sms_messages[0]->receipts;
i get:
Catchable fatal error:  Object of class stdClass could not be converted to string

if anyone could help it would be most appreciated!!!
0
<script>

         $(document).ready(function()  {
                    $('#importSubmit').on('click',function(){
                    var phone1=document.getElementById('phone').value;
                    //alert(phone1);
                    var msg=document.getElementById("message").value;
                    // alert(msg);
                    var opt=document.getElementById("opt").value;
                    //alert(opt);
                    var impt=document.getElementById("importSubmit").value;
                    //alert(impt);
   
                   
                    $.ajax({

                    type: 'GET',

                    url: 'http://localhost/whatsapp_message_sender/importData.php?',

                    dataType: "json",
                     //data:'foo='+ bar+'&calibri='+ nolibri,
                    data: 'importSubmit='+impt+'&phone=' +phone1+'&message='+msg+'&opt='+opt,    

                    success: function(data){
                    //alert(data);
                    $('#lkct').html(data);
                   

                                              },
                error: function(jqXHR, textStatus, errorThrown)

                {

                  alert("Error: "+errorThrown+" , Please try again");  

                }      

      });

        });
});
   //});
</script>


where I went wrong here  I'm getting this error  please help me to solve problem
0
how to post the ANGULAR 4 Form DATA in Offline JSON..
0
I would like to get multiple Json outputs of multiple iperf3 tests to a single file and plot be able to do graphing on it.
0
I am currently developing a credit check app which uses web services and the response I get is in Json string format. I tried converting this to a Json object... however I was unsuccessful. I need to store this json result into an excel document. The json result is in the following format after desterilizing:

[
{
"Key": "CreditResult",
"Value": [
[
{
"Key": "ConsumerInfo",
"Value": {
"RecordSeq": "01",
"Part": "001",
"PartSeq": "01",
"ConsumerNo": "943599475",
"Surname": "TEST SURNAME",
"Forename1": "TEST NAME",
"Forename2": "",
"Forename3": "",
"Title": "MS",
"Gender": "F",
"NameInfoDate": "20170129",
"DateOfBirth": "20170101",
"IdentityNo1": "1234567891234",
"IdentityNo2": "",
"MaritalStatusCode": "",
"MaritalStatusDesc": "",
"Dependants": "00",
"SpouseName1": "",
"SpouseName2": "",
"TelephoneNumbers": "H(000)0000000 B(0000)0000",
"DeceasedDate": "00000000"
}
},
{
"Key": "LastAddress",
"Value": {
"ConsumerNo": "943599475",
"InformationDate": "20170911",
"Line1": "ABC",
"Line2": "",
"Suburb": "ABC",
"City": "ABC",
"PostalCode": "0000",
"ProvinceCode": "A",
"Province": "ABC",
"AddressPeriod": "00",
"OwnerTenant": "",
"AddressChanged": "Y"
}
}
],
[
{
"Key": "CreditScore",
"Value": {
"ConsumerNo": "943599475",
"PolicyFilters": [
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0"
],
"Indicators": [
{
"Type": "00",
"Score": "000"
},
{
"Type": "00",
"Score": "0"
},
{
"Type":…
0
hi,
i am looking for json web tokens end to end example using java. can you please advise
0

JSON

633

Solutions

638

Contributors

JavaScript Object Notation, or JSON, is human-readable text used when transmitting data objects consisting of attribute:value pairs between a server and a web application as an alternative to XML. JSON, while it is originally derived from JavaScript, is a language-independent data format. Code for parsing and generating JSON data is available in many programming languages.

Related Topics