josdejong / jsoneditor

A web-based tool to view, edit, format, and validate JSON
http://jsoneditoronline.org
Apache License 2.0
11.55k stars 2.04k forks source link

What is the URL pattern to read file direct from server? #692

Closed GamesThatWork closed 5 years ago

GamesThatWork commented 5 years ago

Beautiful work. Thanks for sharing. How do I access edited JSON file served by http://jsoneditoronline.org ?

josdejong commented 5 years ago

That's not officially supported but if you check out the network tab in the Developer Tools of your browser and filter on /v1/docs you can see the REST requests when opening/saving a document. What do you need it for exactly?

GamesThatWork commented 5 years ago

Jos

Thank you for the response. I will sniff those request packets.. I tried a little last night but got lost in the network traffic.

I am making a small fun game for a school client..it must carry a bunch of educational information and that material changes pretty frequently also there are a great many (simple) levels of run & jump puzzles to author and also i have several remote workers on the project

my solution is to develop some basic classes and store all the information in json files on a node based server somewhere a designer can edit the game while playing it (using drag and drop) and the json file for that level is updated with ajax --( this works nicely now)

But I want to offer my artists/educators the ability to browse and edit the json data directly your editor is far and away the most solid and handsome of the 10 I reviewed this is a low budget project and I hope to use an existng public service rather than learn to implement the code you generously shared on GitHub

this game will unfortunately require 15 (or 54, depending on final architecture) different json files but these are really stored on my Node based server.. not your server

my client code asks your client code to load the correct file from my server window.open(' http://jsoneditoronline.org/?url=http://localhost%3A8081%3Ftarget%3Dusa.level1 ', '_blank'); and I edit onscreen. (THis WORKS) I would love to POST it back from your client to my server, but this is not supported. Instead I have your client save it to your server, then my client will download it from your server (HELP NEEDED HERE) and the artist will play and test it, and then save to my server.

I do not need to keep files on your server for more than a few seconds each and really i could use the same arbitrary filename for all of them.

There is not much budget for this project, but I would be happy to send you a thank you of $100USD for use of the editor*.. it will only be used by a three or four people for about six weeks of production. and even then used rarely.

In any case -- sorry for the long note -- and thank you very much for your generous and highly competent work

Dov

*ad-free version would be nice, of course, in that case

Dov

On Fri, Apr 26, 2019 at 3:41 PM Jos de Jong notifications@github.com wrote:

That's not officially supported but if you check out the network tab in the Developer Tools of your browser and filter on /v1/docs you can see the REST requests when opening/saving a document. What do you need it for exactly?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692#issuecomment-487176538, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX35QP6WR52KJGSJ7T3PSNK2TANCNFSM4HIMTYZA .

GamesThatWork commented 5 years ago

Cleanest of course would be if I can post from your client back to my server using the existing simple api that my wysiwyg client already uses.. CORS friendly already..

Maybe that means the solution is to pull and fork the repo. I just am afraid of the learning curve and work distracting me from my real project...

On Fri, Apr 26, 2019, 4:40 PM Dov dov@bigfun.net wrote:

Jos

Thank you for the response. I will sniff those request packets.. I tried a little last night but got lost in the network traffic.

I am making a small fun game for a school client..it must carry a bunch of educational information and that material changes pretty frequently also there are a great many (simple) levels of run & jump puzzles to author and also i have several remote workers on the project

my solution is to develop some basic classes and store all the information in json files on a node based server somewhere a designer can edit the game while playing it (using drag and drop) and the json file for that level is updated with ajax --( this works nicely now)

But I want to offer my artists/educators the ability to browse and edit the json data directly your editor is far and away the most solid and handsome of the 10 I reviewed this is a low budget project and I hope to use an existng public service rather than learn to implement the code you generously shared on GitHub

this game will unfortunately require 15 (or 54, depending on final architecture) different json files but these are really stored on my Node based server.. not your server

my client code asks your client code to load the correct file from my server window.open(' http://jsoneditoronline.org/?url=http://localhost%3A8081%3Ftarget%3Dusa.level1 ', '_blank'); and I edit onscreen. (THis WORKS) I would love to POST it back from your client to my server, but this is not supported. Instead I have your client save it to your server, then my client will download it from your server (HELP NEEDED HERE) and the artist will play and test it, and then save to my server.

I do not need to keep files on your server for more than a few seconds each and really i could use the same arbitrary filename for all of them.

There is not much budget for this project, but I would be happy to send you a thank you of $100USD for use of the editor*.. it will only be used by a three or four people for about six weeks of production. and even then used rarely.

In any case -- sorry for the long note -- and thank you very much for your generous and highly competent work

Dov

*ad-free version would be nice, of course, in that case

Dov

On Fri, Apr 26, 2019 at 3:41 PM Jos de Jong notifications@github.com wrote:

That's not officially supported but if you check out the network tab in the Developer Tools of your browser and filter on /v1/docs you can see the REST requests when opening/saving a document. What do you need it for exactly?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692#issuecomment-487176538, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX35QP6WR52KJGSJ7T3PSNK2TANCNFSM4HIMTYZA .

josdejong commented 5 years ago

Thanks for the explanation. Saving to url is actually a good idea and thinking about it, not that complicated.

I've implemented a save to url now in v4.12.0 (see bottom center). You can also press Ctrl+S after you've loaded from url.

image

Does that help you?

GamesThatWork commented 5 years ago

Jos

Thank you very much for making this change! however v4.12.0 may be imperfect:

Using the menu, nothing happens.

Using CTL/S

[image: image.png]

It would be useful if this worked using (as default) the exact original URL

My server expects the same query string for read or write, it checks if the request is GET or POST to decide whether to read or write In POST request, it expects a proper JSON string as application/json (not a = pair) Enclosed (for laughs) is my simple server

Thank you for your interest!

Dov

On Sat, Apr 27, 2019 at 11:56 AM Jos de Jong notifications@github.com wrote:

Thanks for the explanation. Saving to url is actually a good idea and thinking about it, not that complicated.

I've implemented a save to url now in v4.12.0 (see bottom center). You can also press Ctrl+S after you've loaded from url.

[image: image] https://user-images.githubusercontent.com/568626/56851908-c660b600-6914-11e9-82db-96c5b467a424.png

Does that help you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692#issuecomment-487297114, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX7FIWOYR234X62I73DPSRZGNANCNFSM4HIMTYZA .

const port = 8081; const jsonfile = "sckids" const jsonpath = "../" const jsonextn = ".json"

var http = require('http'), fs = require('fs'), url = require('url'); const queryString = require('query-string');

http.createServer(function(request, response){ var q = queryString.parse( url.parse(request.url).query ); var filename = jsonpath + ( q.target || jsonfile ) + jsonextn ; console.log( filename );

if ('POST' == request.method.toUpperCase()) {
    console.log("POST to " + filename );
    let body = '';
    request.on('data', more => body += more.toString() );
    request.on('end', () => {
        //console.log(body);
        response.writeHead( 200, {
            "Content-Type": "application/json",
            'Access-Control-Allow-Origin'  : '*',
            'Access-Control-Allow-Headers' : 'Origin, X-Requested-With, Content-Type, Accept',
            'Access-Control-Allow-Methods' : 'POST, GET, PUT, DELETE, OPTIONS'
            });

        fs.writeFile( filename, body, (err)=>{
            let msg = err | "data saved okay.";
            response.end(msg);
          //  console.log( msg, err);
            });
        });
    }
//if ('GET' == request.method.toUpperCase() ){
else {
    if( !fs.existsSync( filename ) ) filename = "../defaultScene.json";
    console.log("GET from " + filename );
    fs.readFile( filename, function(err, content) {  
        if(err)            content = "file screwed up <br/>"+ err;  
        response.writeHead( 200, {
            "Content-Type": "application/json",
            'Access-Control-Allow-Origin'  : '*',
            'Access-Control-Allow-Headers' : 'Origin, X-Requested-With, Content-Type, Accept',
            'Access-Control-Allow-Methods' : 'POST, GET, PUT, DELETE, OPTIONS'
            });
        response.end(content, "utf-8");  
    });
}

}).listen(port); console.log("server initialized ... listening at port "+port );

josdejong commented 5 years ago

If you click "Save to url", a popup should open where you can enter the url you want to use. When pressing "Save" there, a POST request to that url should be created, see screenshot. You can check whether a POST request has been made in the Network tab of your Developer Tools, filter on the url that you just entered in the popup.

image

GamesThatWork commented 5 years ago

Thank you, Jos

It works as described on EDGE (files save fine on my server) It fails in CHROME - no response whatsoever to choice of "save to URL" in dropdown menu [image: image.png]

Logs for both edge and chrome are in the attached file

Thanks for your interest -- sorry to report problems

Dov

On Sun, Apr 28, 2019 at 10:16 AM Jos de Jong notifications@github.com wrote:

If you click "Save to url", a popup should open where you can enter the url you want to use. When pressing "Save" there, a POST request to that url should be created, see screenshot. You can check whether a POST request has been made in the Network tab of your Developer Tools, filter on the url that you just entered in the popup.

[image: image] https://user-images.githubusercontent.com/568626/56865594-3ed87d00-69d0-11e9-9873-e5520c553634.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692#issuecomment-487382944, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX7PDGSQ4SHJBX2BZDLPSWWFPANCNFSM4HIMTYZA .

CHROME CONSOLE @ http://jsoneditoronline.org/?url=http://localhost%3A8081%3Ftarget%3Dusa.level1

loading app.min.js:13 [Violation] 'requestAnimationFrame' handler took 85ms app.min.js:13 [Violation] 'requestAnimationFrame' handler took 59ms pubfig.min.js:1 Resource interpreted as Document but transferred with MIME type application/json: "https://ssp.pub.network/ssp-server/cookiesync?fsuid=8180de0c-0ea2-407e-90e2-d86255a1260f&dsp=152&dsp_uid=41a9c0c09352b400". (anonymous) @ pubfig.min.js:1 c @ pubfig.min.js:1 (anonymous) @ pubfig.min.js:1 yj.push @ pubads_impl_2019041801.js:1 Aj @ pubads_impl_2019041801.js:1 (anonymous) @ pubads_impl_2019041801.js:1 Sn @ pubads_impl_2019041801.js:1 (anonymous) @ pubads_impl_2019041801.js:1 (anonymous) @ pubads_impl_2019041801.js:1 42[Violation] Added non-passive event listener to a scroll-blocking event. Consider marking event handler as 'passive' to make the page more responsive. See Enabler.js:148 [ 0.001s] [studio.sdk]
[Violation] Forced reflow while executing JavaScript took 563ms [Violation] 'requestIdleCallback' handler took 77ms Enabler.js:148 [ 1.264s] [studio.sdk] Using default ad parameters in test environment. Simulating local events. prebid-analytics-1.33.5.js:3 [Violation] 'setTimeout' handler took 174ms "save to URL" picked

CHROME NETWORK REPORT OF XHR LOAD Request URL: http://localhost:8081/?target=usa.level1 Request Method: GET Status Code: 200 OK Remote Address: [::1]:8081 Referrer Policy: no-referrer-when-downgrade Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS Access-Control-Allow-Origin: * Connection: keep-alive Content-Type: application/json Date: Mon, 29 Apr 2019 06:41:54 GMT Transfer-Encoding: chunked Provisional headers are shown Accept: application/json DNT: 1 Origin: http://jsoneditoronline.org Referer: http://jsoneditoronline.org/?url=http://localhost%3A8081%3Ftarget%3Dusa.level1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 target: usa.level1

EDGE CONSOLE

loading HTML1300: Navigation occurred. jsoneditoronline.org (1,1)

HTML1521: Unexpected "/body>" or end of file. All open elements should be closed before the end of the document.
jsoneditoronline.org (206,1)

SEC7131: Security of a sandboxed iframe is potentially compromised by allowing script and same origin access.

DOM7009: Unable to decode image at URL: 'https://googleads4.g.doubleclick.net/pcs/view?xai=AKAOjst58wDzE85VKp6xnKSI_8AzIVs20us-2Y5e7lCLgxIZqtLbtgXGNiMdb8Ivd6IP998yM4xSZyQLja5nYxcxP3dKlStHq2uMybY4CXoUitoRGweaRJTeOr37D9mEfsOkGJiwDmaVemiTRciRuTnezDn_YNOCqLVf91ZU&sig=Cg0ArKJSzO9req6GLRSMEAE&urlfix=1&adurl=' with MIME: 'image/gif'.
view (1,1)

SEC7112: Script from https://kohls.demdex.net/event?d_event=imp&d_src=204971&d_site=2516016&d_creative=113234712&d_adgroup=438588812&d_placement=241615205&d_campaign=22397016 was blocked due to mime type mismatch
B22397016.241615205;dc_ver=48.125;dc_eid=40004000;sz=160x600;u_sd=1;u=TV5%2BPAI~DC%2BIMI~%2BDSP~TD%2BBID~3b4cab76-579d-4723-8259-ab6444077414;dc_adk=1633449855;ord=i4pq6n;click=http%3A%2F%2Finsight.adsrvr.org%2Ftrack%2Fclk%3Fimp%3D3b4cab76-579d-4723-8259-ab6444077414%26ag%3Daii2q9d%26sfe%3Defe1ba4%26sig%3DB3NzZWk1ncuipnGfRgJSvp3idncHOXujUAgsjRUIOgM.%26crid%3Dbgemlsh1%26cf%3D797214%26fq%3D2%26td_s%3Djsoneditoronline.org%26rcats%3Djba%26mcat%3D%26mste%3D%26mfld%3D2%26mssi%3DNone%26mfsi%3Dt3nkzw6jiq%26sv%3Dfederatedmedia%26uhow%3D26%26agsa%3D%26rgco%3DUnited%2520States%26rgre%3DGeorgia%26rgme%3D524%26rgci%3DDuluth%26rgz%3D30096%26dt%3DPC%26osf%3DWindows%26os%3DWindows10%26br%3DEdge%26svpid%3D239429%26rlangs%3Den%26mlang%3D%26did%3D%26rcxt%3DOther%26tmpc%3D16.2%26vrtd%3D%26osi%3D%26osv%3D%26daid%3D%26dnr%3D0%26vpb%3D%26c%3DOAE.%26dur%3DCiYKDWNoYXJnZS1hbGwtMTgiFQju__________8BEghpYXhkMDAyYwoZCgdnZmUwYXlyENoYIgsI77XBdBIEbm9uZQo2Ch1jaGFyZ2UtYWxsSW50ZWdyYWxCcmFuZFNhZmV0eSIVCPn__________wESCGludGVncmFsCjYKHWNoYXJnZS1hbGxJbnRlZ3JhbFZpZXdhYmlsaXR5IhUI-P__________ARIIaW50ZWdyYWwKPQokY2hhcmdlLWFsbEludGVncmFsU3VzcGljaW91c0FjdGl2aXR5IhUI9f__________ARIIaW50ZWdyYWwQ2hg.%26crrelr%3D%26npt%3D%26svscid%3D411865%26mk%3DMicrosoft%26mdl%3DEdge%2520-%2520Windows%26ipl%3D411865%26fpa%3D736%26pcm%3D3%26ict%3DUnknown%26r%3D;dc_rfl=1,http%3A%2F%2Fjsoneditoronline.org%2F%3Furl%3Dhttp%253A%252F%252Flocalhost%253A8081%253Ftarget%253Dusa.level1$0;xdt=1;crlt=(7ug9Sn-6l;osda=2;sttr=56;prcl=s (1,1)

SEC7131: Security of a sandboxed iframe is potentially compromised by allowing script and same origin access.

a: 0.4ms

2 CONSOLE1810304: console.memory is not implemented and will return 0 for all attributes. Please use the memory profiler to monitor memory utilization.

SEC7131: Security of a sandboxed iframe is potentially compromised by allowing script and same origin access.

SCRIPT438: Object doesn't support property or method 'sovrnReady'
sovrn_standalone_beacon.js (2,2249)

DOM7009: Unable to decode image at URL: 'https://pagead2.googlesyndication.com/pagead/gen_204?id=sodar&v=30&t=2&bgai=BA4GspZvGXIP0CsCDoPwP99mniAUAAAAAOAHgBAI&bg=!qqmlqbFE2_w29U1UrfUCAAAB_lIAAACKmQFVSPZhszFFdq9npGQBo32XqJ1Gw9RjUvje_oG2b4sa4GBRragpPYM4VXwqUaUj9-jKbr7Hix-T6tZ9-xdr-MOHjERbCioG-y-1hv63K_-WunqplZ51YxlvVPvBqvWyHX4gd9gl-vIZ-FcST-VdQ0pID9reZSa9jmP0JxIKUxgkPLHYjZANhMNIgVOC6bHAj4y31fjIQn1vlPqYtA95oyDKpfJvElJllA3SDr896oOah2LV3lX5DQbLretZJh56FzxlhqlgAVEXxoaAp-eBd2W3P6CV0sshtespWJNs7EOrICLl4hOGJstHhsBiofftja9VA_BRG5fCtp38BnPRAD6JoaOXda3oBRbTOoOiB-ldO711sWMkMjlGWPydZWEEF_GaC2PkTgq1hdtL2rG1lp9Y6dRbePZ9Tdh_lfBXvsciF0ch399CpyNwTHQ2InM1nyz-98KA2Pk' with MIME: 'image/gif'.
gen_204 (1,1)

SEC7131: Security of a sandboxed iframe is potentially compromised by allowing script and same origin access.

DOM7009: Unable to decode image at URL: 'https://contextual.media.net/cksync.php?cs=3&type=sov&ovsid=b13dd9750f794f5a98c24d32&redirect=https%3A%2F%2Fce.lijit.com%2Fmerge%3Fpid%3D1023%263pid%3D%24%7BUSER%7D&gdpr=0&gdpr_consent=' with MIME: 'image/gif'.
cksync.php (1,1)

Ignoring gdpr param, it should be 1 or 0
load-cookie.html (10,1404)

Ignoring gdpr_consent param, it should be a non empty value
load-cookie.html (10,1536)

SEC7131: Security of a sandboxed iframe is potentially compromised by allowing script and same origin access.

Invoking image pixel user sync for bidder: "gamoshi"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "openx"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "rhythmone"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "sonobi"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "sovrn"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "conversant"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "adkernelAdn"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "lifestreet"
load-cookie.html (10,2166)

Invoking image pixel user sync for bidder: "improvedigital"
load-cookie.html (10,2166)

"save to URL" picked

saveToUrl

EDGE XHR NETWORK REPORT

loading Request URL: http://localhost:8081/?target=usa.level1 Request Method: GET Status Code: 200 / OK

saving Name Protocol Method Result Content type Received Time Initiator http://localhost:8081/?target=usa.level1 HTTP OPTIONS 200 application/json 11.67 ms XMLHttpRequest [no response payload] Name Protocol Method Result Content type Received Time Initiator http://localhost:8081/?target=usa.level1 HTTP POST 200 application/json 47.59 ms XMLHttpRequest [no response payload]

josdejong commented 5 years ago

It fails in CHROME - no response whatsoever to choice of "save to URL" in dropdown menu

Does the popup asking to enter a url open? Or not? Can it be that your browser has an old version of the web application cached or something? (Press Ctrl+F5 to force refreshing)

I've tested on both Chome and Edge, both work fine here. How can I reproduce your issue?

GamesThatWork commented 5 years ago

Does the popup asking to enter a url open? Or not?

Pop up and MenuClose work fine on Save Online

Can it be that your browser has an old version of the web application cached or something?

seems okay--- [image: image.png]

(Press Ctrl+F5 to force refreshing)

Wow!! I tried this anyway (I had already tried Ctrl/R) and this solved my problem

I am not sure what was out of date -- but something was and this certainly fixed it!!!!

Thank you,. Jos!!!!

I have made the round trip --

  1. play and edit in-game
  2. (auto) save to server
  3. launch jsoneditoronline from game
  4. modify in json
  5. save to url
  6. reopen in game
  7. enjoy changes

Wonderful!!! Now i do not need to implement much of an in game editor -- mostly just positioning the assets. Bravo!

Dov

josdejong commented 5 years ago

ahh, so it was a caching action indeed, glad to hear it's working now :) It's a nice feature.

Note that after you've opened from url (your step 3), you can press Ctrl+S to immediately save as url.

GamesThatWork commented 5 years ago

I have been using this now for the last six weeks. It is just great, Jos!! THANK YOU!!

In April, I promised to pay $100 license fee for using it -- is there a Patreon or similar method of paying?

Dov

On Mon, Apr 29, 2019 at 11:49 AM Jos de Jong notifications@github.com wrote:

ahh, so it was a caching action indeed, glad to hear it's working now :) It's a nice feature.

Note that after you've opened from url (your step 3), you can press Ctrl+S to immediately save as url.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692#issuecomment-487632968, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXXZGAK7COLIUG34VOSTPS4J2TANCNFSM4HIMTYZA .

josdejong commented 5 years ago

Glad to hear Dov, thanks for your enthusiasm :)

Some sponsoring would be welcome of course :smiley:, but please feel free not to - you're not required in any way to do so. We're just too early to be able to use Github sponsors. I do have a Paypal account, wjosdejong@gmail.com, maybe that could work.

GamesThatWork commented 5 years ago

Thanks I appreciate the builtin colorpicker and the extract feature

copy and paste of nodes would be great, but I just use the text edit window when doing that

one little bug in the url interface is that while it reads from and saves to urls that include query strings these cause it to forget the entire url between load and save ( that url memory feature is priceless)

Dov

On Tue, Jun 25, 2019 at 1:54 PM Jos de Jong notifications@github.com wrote:

Glad to hear Dov, thanks for your enthusiasm :)

Some sponsoring would be welcome of course 😃, but please feel free not to - you're not required in any way to do so. We're just too early to be able to use Github sponsors https://github.com/sponsors. I do have a Paypal account, wjosdejong@gmail.com, maybe that could work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692?email_source=notifications&email_token=AACRXXZ2LZPI2F27BXSPHFLP4JLIZA5CNFSM4HIMTYZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYRBYVA#issuecomment-505551956, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX7RVDNVZPWPW2W3LH3P4JLIZANCNFSM4HIMTYZA .

josdejong commented 5 years ago

Yes, copy and paste would be handy. I'm implementing this in a next version (but that's still far from finished, will take a long time).

How can I reproduce your issue with urls containing query parameters not being remembered?

GamesThatWork commented 5 years ago

Jos

Thank you for your continued concern

How can I reproduce your issue with urls containing query parameters not being remembered?

This is the URL I use

https://jsoneditoronline.org/?url=https://ipnqzfz3h8.execute-api.us-west-2.amazonaws.com/public/level/lift/0?author=DovJacobson

and it doesn't help if i do this https://jsoneditoronline.org/?url=https://ipnqzfz3h8.execute-api.us-west-2.amazonaws.com/public/level/lift %3Fauthor=DovJacobson https://jsoneditoronline.org/?url=https://ipnqzfz3h8.execute-api.us-west-2.amazonaws.com/public/level/lift%3Fauthor=DovJacobson

[image: image.png]

On Wed, Jun 26, 2019 at 3:25 PM Jos de Jong notifications@github.com wrote:

Yes, copy and paste would be handy. I'm implementing this in a next version (but that's still far from finished, will take a long time).

How can I reproduce your issue with urls containing query parameters not being remembered?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692?email_source=notifications&email_token=AACRXXZABS7L3TXWEZL3VMTP4O6WLA5CNFSM4HIMTYZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYURZUQ#issuecomment-506010834, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX2KS53LOWJ3OG3ZKZTP4O6WLANCNFSM4HIMTYZA .

josdejong commented 5 years ago

Ah, I see. What's going on here is that we have a url inside an url. The url in the query parameter should therefore be escaped. So this will work:

https://jsoneditoronline.org/?url=https%3A%2F%2Fipnqzfz3h8.execute-api.us-west-2.amazonaws.com%2Fpublic%2Flevel%2Flift%2F0%3Fauthor%3DDovJacobson

If you enter the url via the menu Open -> Open Url, it will do this escaping for you.

GamesThatWork commented 5 years ago

Jos

That did it!

Instead of stupidly just manually changing ? to %3F i now wrapped encodeURIComponent around the whole uri and it works like a charm!!!!

(I am invoking json edit online directly out of my playable and self editable game... with window.open('https://jsoneditoronline.org/?url=' + encodeURIComponent( levelServer +selector.scene.value+ "/" +selector.round.value+ "?author=" + selector.author.value), '_jsoneditor');

You can adjust levels (move the platforms, spawn points, etc) interactively while playing the game and then jump into json editor to add new features, restructure levels, etc.

i would love to have an easy way to know when to reload my game (or the whole game page) after json editor saves(and ideally close the json editor page at the same time)

Dov

In case you are interested

feel free to take a look if you like http://smart-company-kids-game.s3-website-us-west-2.amazonaws.com/ you can edit (only) this level safely [image: image.png] use arrow keys to play use mouse to re-design use [EDIT] button in [FILE] menu to invoke json editor

On Tue, Jul 2, 2019 at 1:28 PM Jos de Jong notifications@github.com wrote:

Ah, I see. What's going on here is that we have a url inside an url. The url in the query parameter should therefore be escaped. So this will work:

https://jsoneditoronline.org/?url=https%3A%2F%2Fipnqzfz3h8.execute-api.us-west-2.amazonaws.com%2Fpublic%2Flevel%2Flift%2F0%3Fauthor%3DDovJacobson

If you enter the url via the menu Open -> Open Url, it will do this escaping for you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692?email_source=notifications&email_token=AACRXX6RHDSBGZPL26MTULLP5OFQ5A5CNFSM4HIMTYZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZB7VHI#issuecomment-507771549, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX4PGYLMN5RZBTJ7KWTP5OFQ5ANCNFSM4HIMTYZA .

GamesThatWork commented 5 years ago

oops -- updated now to proper save/edit functionality

On Tue, Jul 2, 2019 at 1:59 PM Dov dov@bigfun.net wrote:

Jos

That did it!

Instead of stupidly just manually changing ? to %3F i now wrapped encodeURIComponent around the whole uri and it works like a charm!!!!

(I am invoking json edit online directly out of my playable and self editable game... with window.open('https://jsoneditoronline.org/?url=' + encodeURIComponent( levelServer +selector.scene.value+ "/" +selector.round.value+ "?author=" + selector.author.value), '_jsoneditor');

You can adjust levels (move the platforms, spawn points, etc) interactively while playing the game and then jump into json editor to add new features, restructure levels, etc.

i would love to have an easy way to know when to reload my game (or the whole game page) after json editor saves(and ideally close the json editor page at the same time)

  • because some people get confused and overwrite their recent edits by tweaking and saving an outdated file in one of these two editing systems which both operate on the same json file*

Dov

In case you are interested

feel free to take a look if you like http://smart-company-kids-game.s3-website-us-west-2.amazonaws.com/ you can edit (only) this level safely [image: image.png] use arrow keys to play use mouse to re-design use [EDIT] button in [FILE] menu to invoke json editor

On Tue, Jul 2, 2019 at 1:28 PM Jos de Jong notifications@github.com wrote:

Ah, I see. What's going on here is that we have a url inside an url. The url in the query parameter should therefore be escaped. So this will work:

https://jsoneditoronline.org/?url=https%3A%2F%2Fipnqzfz3h8.execute-api.us-west-2.amazonaws.com%2Fpublic%2Flevel%2Flift%2F0%3Fauthor%3DDovJacobson

If you enter the url via the menu Open -> Open Url, it will do this escaping for you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692?email_source=notifications&email_token=AACRXX6RHDSBGZPL26MTULLP5OFQ5A5CNFSM4HIMTYZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZB7VHI#issuecomment-507771549, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX4PGYLMN5RZBTJ7KWTP5OFQ5ANCNFSM4HIMTYZA .

josdejong commented 5 years ago

Great to hear you got it working :+1:

I had a short look at the game but I'm not sure what I have to do.

Please note that the (free and public) storage of JSON document for https://jsoneditoronline.org is meant for developers wanting to do some manual debugging/editing of their JSON object. It is not meant to be used as a database for external applications. If you're building a game or other application needing storage, you should look into a service like Firebase, MongoDB, or AWS S3 to store your data. As long as you're in a experimentation phase without heavy usage it's ok with me though if it makes life easy for you.

GamesThatWork commented 5 years ago

Thanks, but I am NOT using your servers, (except months ago during early experiments... as this very old subject line indicates ). We store the data on AWS with a Lambda based API and an S3 actual store.

Sorry if I confused you with too much detail.

I

On Thu, Jul 4, 2019, 1:54 PM Jos de Jong notifications@github.com wrote:

Great to hear you got it working 👍

I had a short look at the game but I'm not sure what I have to do.

Please note that the (free and public) storage of JSON document for https://jsoneditoronline.org is meant for developers wanting to do some manual debugging/editing of their JSON object. It is not meant to be used as a database for external applications. If you're building a game or other application needing storage, you should look into a service like Firebase, MongoDB, or AWS S3 to store your data. As long as you're in a experimentation phase without heavy usage it's ok with me though if it makes life easy for you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josdejong/jsoneditor/issues/692?email_source=notifications&email_token=AACRXX3CP6LHCBBJFZNXMR3P5Y2CFA5CNFSM4HIMTYZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZH5HEY#issuecomment-508547987, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRXX3CIESBGSYO4TVP2LTP5Y2CFANCNFSM4HIMTYZA .

josdejong commented 5 years ago

Okido :+1:

Playmatics2 commented 4 years ago

Sorry to necro this, but how would I implement this saving to (local) url using this software on my own server? I'm trying to follow the examples, but I only see one with opening and saving files from my local computer, rather than the server I want to use this on.

josdejong commented 4 years ago

@Playmatics2 if you have a local server running you can indeed load JSON in the (online) https://jsonditoronline.org, or you could create your own local server and your own local frontend where you load a JSONEditor and load data with some basic REST calls.