Awesome work man! Very useful extension.
1 Like
FahadAhmad
(Fahad Ahmad)
#12
Great extension, @Mohamed_Tamer!
1 Like
That is the first in this community, it is just a reupload with a new topic
1 Like
Vaibhav
(Vaibhav)
#16
Yes I know that. A traditional copy-paste mistake
3 Likes
Nice extension.
The name of the block is so long.
String2Dictionary will be nice
2 Likes
Edit: This method seems not working always.
We can also do it like this.
5 Likes
dora_paz
(Dora)
#19
Not always, see why here…
2 Likes
Thanks @hammerhai @marco_tanzi @WatermelonIce @The_K_Studio @FahadAhmad @Srrazmi @Vaibhav @sonumohammad333 @AryanGupta for your posts And every one else how liked this extension
Vaibhav:
First extension???
It’s really my first extension to share in the community But actually I didn’t create a new topic for it, that’s why I said it’s my first extension
Thanks for your suggestion , I will consider renaming it , in the next update maybe 1
!
6 Likes
AryanGupta
(Aryan Gupta)
#22
This post was flagged by the community and is temporarily hidden.
Actually the name is just from App Inventor (because this block is missing in Kodular). The source is most probably from app inventor too
1 Like
Yes, you are right , I think he meant the extension name .
The source isn’t hard actually I’ve used the JsonUtils class to decode the json:
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2011-2020 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package com.google.appinventor.components.runtime.util;
import android.content.Context;
import android.util.Base64;
import android.util.Log;
import com.google.appinventor.components.runtime.Form;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import gnu.lists.FString;
import gnu.math.IntFraction;
import java.io.File;
import java.io.FileOutputStream;
This file has been truncated. show original
For instance this method:
- * Parses the JSON content represented by {@code jsonString} into a YAIL object. The
- * {@code useDicts} flag controls whether JSON objects are parsed as YailDictionary (true) or
- * associative YailList (false).
- *
- * @param jsonString the JSON text to parse
- * @param useDicts true if YailDictionary should be used for JSON objects,
- * false for associative lists
- * @return the parsed object
- * @throws JSONException if the JSON is malformed
- */
- public static Object getObjectFromJson(String jsonString, boolean useDicts) throws JSONException {
- if ((jsonString == null) || jsonString.equals("")) {
- // We'd like the empty string to decode to the empty string. Form.java
- // relies on this for the case where there's an activity result with no intent data.
- // We handle this case explicitly since nextValue() appears to throw an error
- // when given the empty string.
- return "";
- } else {
- final Object value = (new JSONTokener(jsonString)).nextValue();
- // Note that the JSONTokener may return a value equals() to null.
- if (value == null || value.equals(JSONObject.NULL)) {
The source code is isn’t similar with app Inventor code ( specially after rewriting it ). I’ve optimized it a lot to decrease the extension size.
2 Likes
I was talking about the block.
But its name is lengthy.
1 Like
I misunderstood I actually always see it’s very lengthy,too I will change it in the next update
3 Likes
Rogerio_Rios
(Professional Support)
#28
1 Like
@Mohamed_Tamer
Non-SDK API Usage Violation find in your extension jsontodictionary. Please update your extension.
rxb10
(rxb10)
#30
thank you very much. its help me
Gbu