Jump to content

Json help


Recommended Posts

Hello, 

I'm having a really hard time getting this JSON Library to work. I've attached a valid json file.

Seems like something should be written instead of 0.

#include <json.au3>
#include <json_translate.au3>

$sample_json_file = "c:\temp\sample.json"
$var = _JSONDecode($sample_json_file,'JSON_unpack')
ConsoleWrite($var & @CRLF)

I'm not understanding how the decode function works. Or, it's not working. 

Any advice would be helpful.

Thank you.

sample.json

Edited by CygnusX1
Fixed a typo

Cygnus

Link to comment
Share on other sites

@CygnusX1,

employ error checking. add this line right after the line calling _JSONDecode:

ConsoleWrite('@error=' & @error & @CRLF & '@extended=' & @extended & @CRLF)

the result you will see:

@error=7
@extended=0
0

so, somewhere inside the UDF, some function set the @error macro to 7. should be fairly easy to find out where that happened. go into the UDF and add some debugging statements.

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...