Go Premium for a chance to win a PS4. Enter to Win

x

JSON

567

Solutions

590

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

Hello I am developing Lotus Domino web application.
Basically, this would be online purchase system, where in there would be left side menu and center menu and checkout box.

Now what I need is My Domino Agent would be bring the menu from view like Furniture, Marbles in json format.
I would like to parse this json using Jquery and need to display menu in left side navigator using HTML.


Can anyone please help me this? I am using Lotus Notes 9.0.1
0
Free Tool: Path Explorer
LVL 11
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

Failed to connect to 10.2.217.48 port 443: Connection timed out
0
I need help building the following JSON using native Filemaker 16 commands

{
    "vehicles" : [
       {
         "vehicle_id": "my_vehicle",
         "start_address": {
             "location_id": "berlin",
             "lon": 13.406,
             "lat": 52.537
         }
       }
    ],
    "services" : [
       {
         "id": "hamburg",
         "name": "visit_hamburg",
         "address": {
           "location_id": "hamburg",
           "lon": 9.999,
           "lat": 53.552
         }
       },
       {
         "id": "munich",
         "name": "visit_munich",
         "address": {
           "location_id": "munich",
           "lon": 11.570,
           "lat": 48.145
         }
       },
       {
         "id": "cologne",
         "name": "visit_cologne",
         "address": {
           "location_id": "cologne",
           "lon": 6.957,
           "lat": 50.936
         }
       },
       {
         "id": "frankfurt",
         "name": "visit_frankfurt",
         "address": {
           "location_id": "frankfurt",
           "lon": 8.670,
           "lat": 50.109
         }
       }
    ]
}

Open in new window

0
CFGRID runs into JSON Parse error while fetching data. However, sometimes 20K records come back in the grid while at other times, the error would display for 700 records.
0
HI,
I am using     private static final ObjectMapper mapper = new ObjectMapper();
and trying to do :
        mapper.readValue(value, List.class);
Its giving compile time error: cannot resolve method readValue...
Here my value will be a string liek = ["option1", "option2"]
a json array and i want to convert it to List<String> object.

How should i do it ?

Thanks
0
I have a groovy script that makes an API call to a rest api and it gets a result. The problem is that I need to sent a file instead of a URL for the final requirements. I am not sure how to do that.

So, I need to change:
FROM: map["file_url"] = "https://i.ytimg.com/vi/JPA_rzHDy6o/maxresdefault.jpg"
TO: map["file"] = "@Nda.pdf"

I think this is a much more difficult situation, to send a file instead of a URL. I would suspect, it starts out trying to understand the def client = HttpClientBuilder.create().build() and how this api supports sending a file.

Any pointers on how to do this?

I also suspect that post.addHeader("content-type", "application/json") may not work and instead another header may have to be used. Perhaps multipart/form-data.



Script that works


import groovy.json.JsonSlurper


@Grab(group='org.apache.httpcomponents', module='httpclient', version='4.5.2')

import groovy.json.*

import org.apache.http.client.methods.*
import org.apache.http.entity.*
import org.apache.http.impl.client.*



def map = [:]
map["message"] = "Hi There"
map["title"] = "Title"
map["subject"] = "sub"
map["test_mode"] = "1"
//map["file"] = "@Nda.pdf"
map["file_url"] = "https://i.ytimg.com/vi/JPA_rzHDy6o/maxresdefault.jpg"
map["signers"] = [name: 'bob', email_address: 'ed_fletcher@aol.com']

def jsonBody = new JsonBuilder(map).toString()
println jsonBody


def url = 'https://APIKEYHERE:@api.hellosign.com/v3/signature_request/send'
def …
0
Hi,
Suppose i make a json like {"name" : "xya", "title" :"sample"}
Now suppose someone wants to make this json and send it to the server without the title element.
There are two ways {"name" : "xya"} or {"name" : "xya", "title": null}
Now obviously it is upto the code at server side how it handles. But ideally i feel they should be handled in the same way. Or there is any reason to handle the two different. I mean in a well designed codebase should there be any difference in how this should be handled ?

Thanks
0
0
I have created the following code to recieve data from a WebSocket, and convert the Json string to XML.

This is currently a Console application, but I want to move it onto a GUI with the socket listening on a separate thread.

Can someone give a quick example of how best to do this. From what I see online it looks as though creating a separate class may be the way to go.

using WebSocketSharp;
using Newtonsoft.Json;


namespace WebSocketSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var ws = new WebSocket("ws://xxx.xxx.xxx.xxx")) //Server address
            {
                ws.OnMessage += (sender, e) => ConvertToXml(e.Data);
                ws.Connect();
                ws.Send("BALUS");
                Console.ReadKey(true);
            }
        }

private static void ConvertToXml(String json)
        {
          //  String fileName = String.Format("{0:yyyyMMdd_HHmmffff}", DateTime.Now) + ".xml";

            XmlDocument myXmlNode = JsonConvert.DeserializeXmlNode(json, "root");

            String race = GetElementValue(myXmlNode, "root/raceNumber");
            String first = GetElementValue(myXmlNode, "root/runners[position = '1']/RaceBookNumber");
            String second = GetElementValue(myXmlNode, "root/runners[position = '2']/RaceBookNumber");
            String third = GetElementValue(myXmlNode, "root/runners[position = '3']/RaceBookNumber");
            String fourth = GetElementValue(myXmlNode,

Open in new window

0
Currently I pull Goformz data using Excel VBA code which looks like the code below which works fine.

' Get Rest API Data from Goformz
Dim strUserName As String
Dim strPassword As String

strUserName = ""
strPassword = ""

Dim http As Object, JSON As Object, i As Integer
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", "https://api.goformz.com/v2/formz?" & "status=draft" & "&filter=lastupdateddate%20gt%20" & Sheets("Values").Range("B7") & "%20and%20lastupdateddate%20lt%20" & Sheets("Values").Range("B8") & "&pagesize=" & Sheets("Draft Forms").DraftFormsComboBox1.value & "&pagenumber=" & Sheets("Values").Range("PageNumber").value & "&sort=lastupdateddate%20desc", False
http.setRequestHeader "Authorization", "Basic " & Base64Encode(strUserName & ":" & strPassword)
http.send
Set JSON = ParseJson(http.responseText)
i = 5
For Each Item In JSON
Sheets("Draft Forms").Cells(i, 1).value = Item("status")("status")
Sheets("Draft Forms").Cells(i, 2).value = Format(DateAdd("h", 11, Replace(Left(Item("lastUpdateDate"), 19), "T", " ")), "dd/mm/yyyy hh:mm:ssam/pm")
Sheets("Draft Forms").Cells(i, 3).value = Item("templateId")
Sheets("Draft Forms").Cells(i, 4).value = Item("templateUrl")
Sheets("Draft Forms").Cells(i, 5).value = Item("name")
Sheets("Draft Forms").Cells(i, 6).value = Item("url")
Sheets("Draft Forms").Cells(i, 7).value = Item("assignment")("url")
i = i + 1
Next
     
Sheets("Draft Forms").Range("A4").value = "Status"
Sheets("Draft Forms").Range("B4").value = 

Open in new window

0
[Webinar] Cloud and Mobile-First Strategy
LVL 11
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

A traveller searches for trips from Bern to Berlin on Dec 25, 2013, from 8am (one-way).
A list of the 20 first results returned by a tool is given in the attached ex3-data.json file.

Tips: most fields are self-explanatory, while some may need explanation:
1. boo_return is true for a return trip, false otherwise
2. workTime_sec is the duration that the traveler can work during that part of the trip in seconds.
3. duration_out_sec is the duration of the corresponding outbound part of the trip, in seconds. For return trip, if applicable, there will be a similar field duration_in_sec for the duration of the inbound trip part.

Goals
1. Propose a solution to rank the list of results provided in the attached file.
2. Output the list of ranked results to a file named ex3-output.json.
   Each result must have two additional properties “rank” and “score”, respectively storing the final rank and the score of the trip (If applicable).

========================================
ex3-data.txt
0
Hello Support,

I'm trying to convert Azure JSON file to Terraform TF file.

I was directed to the following linkg:

https://github.com/kvz/json2hcl/blob/master/README.md

From this link I am instructed to download the appropriate release from this link:

https://github.com/kvz/json2hcl/releases

I downloaded

json2hcl_v0.0.6_windows_amd64.exe

However, I'm not sure how to make it work. Can someone show me please?

Cheers
0
Hi ,

I am creating a simple component in Angular 4

-my-account  // angular project folder
--app
----account  // angular component folder
-----css
-----js
-----images
-----account.component.html

//css , js , images are folders I created and put files.


Now I want to use css files from the above css folder in account.component.html.  How do I access ?


Here is my non working code

account.component.html
----------
<head>
 <Link href="css/datatables.min.css" rel="stylesheet" type="text/css"/>
 ....
 </head>
 
 
 I'm getting error
 zone.js:2744 GET http://localhost:4200/css/datatables.min.css 404 (Not Found)

please note this file is already present in css folder.
 
Do you have any suggestion how to access css files in component html   ?  what is the proper way to fix ths issue ?
Need help
1
I have been asked to do some work developing a WebAPI in .Net using VS 2017 and I have been asked to use JSON Web Tokens (JWT).  I plan on staying with the uniform interface but testing the header which will contain a JWT.  I realise that this test needs to happen in line with any GET, POST, PUT, OR DELETE request but prior to it happening.  I am staying close to MVC style of the convention but I don't know how to capture and test the JWT and authorise it.  I do know how to encrypt/construct and decrypt a token.  What I am specifically ignorant is the capture in process and testing to accept or reject any request.
0
Hello,

We have a JSON file that we are trying to read and put the Key and the values in a CSV file. We are getting an error as below. can someone please help?

Attached is the sample JSON file and the Python code we are using.

Our program Parse_workitem.py accepts 2 arguments one is  input_file which is json and the other one is output_file which is csv. When we execute the code as below with both arguments the code is failing with the following error. We are using Python version 2.7.5


./parse_workitem.py --input_file /home/dqadmin/json/work_items.json  --output_file /home/dqadmin/json/work_items.csv
Traceback (most recent call last):
  File "./parse_workitem.py", line 66, in <module>
    main()
  File "./parse_workitem.py", line 54, in main
    value = item.get(key, '')
AttributeError: 'unicode' object has no attribute 'get'


Thank you
parse_workitem.py
sample.txt
0
We had a migration on our sharepoint farm from SP2010 to SP2016 and several things in our custom list forms really appear off and was looking to see if someone else had experienced this and might have a solution for correction. We do have the opportunity to re-migrate so we can make changes on the SP2010 side to prepare for final migration which will happen at the end of next week.

Issue 1 any person or group field on our new or edit forms show up weird, the two icons for check names and browse people directors are now outlines in obnoxious blue lines

Issue 2 the check names function appears to work but the browse triggers an error to the screen JSON is unidentified and rather than getting the old pop-up window it builds an addition to the bottom of the screen for a people selection which is very ugly. And it does not appear that new addition to the bottom of the screen works it just spins.

Issue 3 One of our very standard forms shows up as completely unusable screen shot attached enter image description here

Issue 4 When we include a people or group field on a display form we get a weird icon in front of the actual value see attached enter image description here

Issue 5 We also get a lot of these very strange pics pop up wherever we try to put the textname of a user or group on a page see attached enter image description here

THese are all show stoppers for us to migrate so we are scrambling to try and find answers to fix on the receiving end or on the …
0
I have a custom list application which has a bunch of People/Group fields that worked great in SP2010 on the form the field space showed with two icons (lookup and check).

Code looks like this
<SharePoint:FormField runat="server" id="ff42{$Pos}" controlmode="Edit" fieldname="CSE" __designer:bind="{ddwrt:DataBind('u',concat('ff42',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@CSE')}" />

After converting to SP2016 the icons are outlined in blue amd when you click them you get a JSON error "JSON is Undefined.
0
Hi members,

Hoping to get some counseil I'm writing here my issue:

I have a php script that uses url_get_contents to execute a script and retrieve a json from another domain. Both ends are under my control.

The calling to the function is:

$this->url_to_call = 'http://example.com/b_controller.php';
$jsonData = array(
            'table' => 'countries',
            'key' => '44',
        );
$jsonDataEncoded = json_encode($jsonData);
$post = file_get_contents( $this->url_to_call, null, stream_context_create(array(
                    'http' => array(
                        'protocol_version' => 1.1,
                        'user_agent'       => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36',
                        'method'           => 'POST',
                        'header'           => "Content-type: application/json\r\n".
                            "Connection: close\r\n" .
                            "Content-length: " . strlen($jsonDataEncoded) . "\r\n",
                        'content'          => $jsonDataEncoded,
                    ),
                )));
$data = json_decode($post, true);

Open in new window


If I run this code, in the first attemp I get:

Warning: file_get_contents(http://example.com/b_controller.php): failed to open stream: An error occurred during the connection attempt because the connected part did not respond properly after a period of time, or there was an error in the established connection because the connected host could not respond. in C:\xampp\htdocs\origin_com\a_controller.php on line 220

But if I refresh the page or add if( !$data ) $data = $post = file_get_contents( $this->url_to_cal......; it reponses with the right json.

If I leave the script 2 minutes and re-run it again I get the error.

I have no clues why this is happening.

Any advice will be appreciated.
0
I have a database query that I want to export or convert to a json file.

The query result is something like this

path                         | name          
parameter.name.menu.myname | mike miller

Open in new window


Finaly I need a json structure like

"parameter": {
        "name": {
              "menu": {
                    "myname": " mike miller"
              }
         }
 }

Open in new window


How this is possible?
I work with mysql 10.1.x and php
0
How to Use the Help Bell
LVL 11
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

UseCase 1 :-  Http Method : Get , expected json is {"id":1, "effecitveDate" :"2017-08-13 08:10"} - working fine

UseCase 2 :- Http Method : Get, expecting a list of objects i.e. ["id":1, "effecitveDate" :"2017-08-13 08:10"} ,"id":2, "effecitveDate" :"2017-08-16 08:10"}

but I am getting  date like ["id":1, "effectiveDate": [
            2017,
            8,
            13,
            8,
            10
        ]},
"id":2, "effectiveDate": [
            2017,
            8,
            16,
            8,
            10]}
]

How to solve this date issue.
Note : I am using java8 LocalDateTime.
0
I use twilio api and download the recording below


/2010-04-01/Accounts/ACf071d40db95b8e4d9c206d62b626e6b3/Recordings/REf87ead782e21c8c5fb353992bce20a6dasdfasdfdas.json

How can i make it so I can listen it?
0
Hi Guys,

We wrote an application that downloads json files down to about 80/90 client machines, we have reworked the mechanism but cant get it work correctly

I want to know how we could enable our server to send http status code responses then I can use the reponse.statusCode to see if a new file is available and make this whole thing a lot easier and more robust.
0
I have a web part page displaying 5 web parts. Four of the web parts (Efforts, Phases, Capture Points & Areas) are "provider" web parts, and come from lists that are the sources of 4 lookup columns in the 5th "consumer" web part (Lessons Learned).

The provider web parts are displaying the Title column from the lists.

The Using Javascript/jQuery, I "connected" the 4 provider web parts to the consumer web part, such that when you click on a Title column value, the consumer web part is filtered to show only those records that have the clicked value in the relevant metadata column.

All that is working very nicely.

Now, my requirement is to go one step further, and display the number of items that will be displayed if you click on a Title column value in any of the 4 web parts. If there are none, a "0" should be displayed.

I've constructed a lists service query that successfully returns the number of items that exist for a given, hard-coded, metadata value:
[SiteURL]/_vti_bin/listdata.svc/[ListName]/$count?&$filter=Effort/Title eq 'AAA'

So, the goal is to display such an item count beside the corresponding provider web part value, such as:
Efforts web part:
AAA (10) //assuming there are 10 items in the consumer web part tagged with Effort 'AAA'

Now, I'm bumping up against the current limit of my abilities.

I know that I need code (javascript, rest, ajax, json) for each provider web part with looping to cycle through all of the TD cells that have …
0
<cfoutput>
<cftry>
	<cfhttp url="https://rest.bandsintown.com/artists/spencerkane/events?app_id=day6mgmt&start_date=2017-01-01" result="httpResult" charset="utf-8" method="get"/>
 	<cfset BITdata = deserializeJSON(httpResult.filecontent)/>
	<cfloop array="#BITdata#" index="post">
		<cfif StructKeyExists(post, "datetime")>
			<cfset event_date = post.datetime>
		<cfelse>
			<cfset event_date = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.name")>
		    <cfset ev_title = post.venue.name>
		<cfelse>
            <cfset ev_title = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.city")>
			<cfset city = post.venue.city>
		<cfelse>
			<cfset city = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.region")>
			<cfset region = post.venue.region>
		<cfelse>
			<cfset region = "">
		</cfif>
		<cfif StructKeyExists(post, "offers.url")>
		<cfset tickets = post.offers.url>
			<cfelse>
		<cfset tickets = "">
			</cfif>

<!--- FEED OUTPUT --->        
<cfif not event_date is "">		
#event_date#<p>
#ev_title#<p>
#city#<p>
#region#<p>
#tickets#
<hr />
</cfif>		
	</cfloop>

	<cfcatch type="any">
		<p>
			<cfdump var="#cfcatch#" />
			#LSDateFormat(Now(), "dd-mm-yyyy")# #lsTimeFormat(Now(), "HH:mm")#<br />
			<a href="##">
				Oh, sorry... I can't connect to Bandsintown
			</a>
		</p>
	</cfcatch>

</cftry>
</cfoutput>

Open in new window


My output only gives me the datetime and none of the other structure data even though the raw feed in a browser window definitely shows there is more data to be displayed. I am using Adobe's output structure of data.struct1.substruct but it doesn't display anything.
0
Oh men,
Im wondering if you guys can give me some advice and examples of how i can position my web page in the proper manner,
some tricks or best practices for positioning my page locally
regards
0

JSON

567

Solutions

590

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