SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,730
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    converting raw JSON to vuGen Body text

    It is difficult (and sometimes impossible) to manually converting JSON Web Service "request payloads" provided by a developer to valid vuGen Body="..." syntax because there is a ton of double quoted strings within the request that have to be escaped (i.e " to \" ).

    This thread shares the steps and a vbScript I use to semi-automate converting a raw request payload to text suitable for inclusion in a vuGen's Body text. All four files described below are contained in the attached ZIP file.

    -Terry Horwath

    1. The rawJSON.txt file is a typical request payload provided by a developer. Here is the beginning snippet from this blob:
    Code:
    {"assignmentRecords": {"Assignments" : [{"AssignmentId":"0","DC_ID":"DC32512","staffId":"469", "isNewFacility":"false",
    "TBDayCare":{"DC_ID":"DC32512","CCFSID":"",
    ...
    While it is syntactically well formed and works correctly with whatever web service tool the developer uses it is not compatible with the Body text of a vuGen Web Service request and it is difficult to understand.

    2. So the first thing you want to do is use Free Online JSON Formatter - FreeFormatter.com to format rawJSON.txt, saving that formatted output to rawJSON.c (a .c file is used so that you can use a variety of editors to match brackets). A snippet of that file is:
    Code:
    {
    	"assignmentRecords": {
    		"Assignments": [
    			{
    				"AssignmentId": "0",
    				"DC_ID": "DC32512",
    				"staffId": "469",
    				"isNewFacility": "false",
    ...
    3. While this makes the raw JSON easier to read it is still not compatiable with vuGen Body="..." syntax. For that you need to process the rawJSON.c file with the rawJSON_to_vuGen.vbs script I provide in the ZIP which produces the vuGenJSON.c output file that contains syntax suitable for inclusion in a Body="..." statement. A snippet of this final output is:
    Code:
    "{"
    	"\"assignmentRecords\": {"
    		"\"Assignments\": ["
    			"{"
    				"\"AssignmentId\": \"0\","
    				"\"DC_ID\": \"DC32512\","
    				"\"staffId\": \"469\","
    				"\"isNewFacility\": \"false\","
    ...
    I hopes this will help others writing JSON web service scripts in vuGen.
    Attached Files Attached Files
    Last edited by Terry Horwath; 08-08-2015 at 07:30 PM.

  2. #2
    New Member
    Join Date
    Jul 2013
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Hi I am trying to retrieve the code in your zip file but for some reason it fails to download the zip. Any thoughts ?

  3. #3
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,730
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    I just download the ZIP file attached to the first message in this thread, and then successfully opened it on my computer. From that I take it your system or environment is being inhibited from download files through your browser. Try another browser on your PC or try it from a PC at your home where you are known to be the admin of that PC.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:46 AM.

Copyright BetaSoft Inc.